Программирование

Автор работы: Пользователь скрыл имя, 05 Ноября 2012 в 19:36, курсовая работа

Описание работы

Программное обеспечение — совокупность программ системы обработки информации и программных документов, необходимых для эксплуатации этих программ, а также совокупность программ, процедур и правил, а также документации, относящихся к функционированию системы обработки данных. Программное обеспечение является одним из видов обеспечения вычислительной системы, наряду с техническим (аппаратным), математическим, информационным, лингвистическим, организационным и методическим обеспечением.

Содержание работы

Введение 4
Постановка задачи 5
Методы проектирования 6
Этапы создания ПО 10
Выявление требований 12
Описание программы 14
Проектирование инфологической модели 14
Даталогическое проектирование 15
Разграничение доступа 17
Администратор 18
Пациент 25
Тестирование 30
Общие сведения 30
Процесс тестирования 31
Результаты тестирования 35
Заключение 36
Библиографический список 37
ПРИЛОЖЕНИЕ А 38
ПРИЛОЖЕНИЕ Б 41
ПРИЛОЖЕНИЕ В 42

Файлы: 1 файл

Пояснительная записка ГОТОВО.docx

— 2.39 Мб (Скачать файл)

                string query = "Select * From Patients Where ID=" + param[0];

                if (param.Length > 1)

                {

                    if (param[0] == "ВСЕ" && param[1] == "ВСЕ" && param[2] == "ВСЕ" && param[3] == "ВСЕ")

                        query = "SELECT * From Patients";

                    else

                        if (param[0] == "ВСЕ" && param[1] == "ВСЕ" && param[2] == "ВСЕ" && param[3] != "ВСЕ")

                            query = "SELECT * From Patients where [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                        else

                            if (param[0] == "ВСЕ" && param[1] == "ВСЕ" && param[2] != "ВСЕ" && param[3] == "ВСЕ")

                                query = "SELECT * From Patients where Адрес Like '%" + param[2] + "%'";

                            else

                                if (param[0] == "ВСЕ" && param[1] == "ВСЕ" && param[2] != "ВСЕ" && param[3] != "ВСЕ")

                                    query = "SELECT * From Patients where Адрес Like '%" + param[2] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                                else

                                    if (param[0] == "ВСЕ" && param[1] != "ВСЕ" && param[2] == "ВСЕ" && param[3] == "ВСЕ")

                                        query = "SELECT * From Patients where Полис Like '%" + param[1] + "%'";

                                    else

                                        if (param[0] == "ВСЕ" && param[1] != "ВСЕ" && param[2] == "ВСЕ" && param[3] != "ВСЕ")

                                            query = "SELECT * From Patients where Полис Like '%" + param[1] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                                        else

                                            if (param[0] == "ВСЕ" && param[1] != "ВСЕ" && param[2] != "ВСЕ" && param[3] == "ВСЕ")

                                                query = "SELECT * From Patients where Полис Like '%" + param[1] + "%' AND Адрес Like '%" + param[2] + "%'";

                                            else

                                                if (param[0] == "ВСЕ" && param[1] != "ВСЕ" && param[2] != "ВСЕ" && param[3] != "ВСЕ")

                                                    query = "SELECT * From Patients where Полис Like '%" + param[1] + "%' AND Адрес Like '%" + param[2] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                                                else

                                                    if (param[0] != "ВСЕ" && param[1] == "ВСЕ" && param[2] == "ВСЕ" && param[3] == "ВСЕ")

                                                        query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%'";

                                                    else

                                                        if (param[0] != "ВСЕ" && param[1] == "ВСЕ" && param[2] == "ВСЕ" && param[3] != "ВСЕ")

                                                            query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                                                        else

                                                            if (param[0] != "ВСЕ" && param[1] == "ВСЕ" && param[2] != "ВСЕ" && param[3] == "ВСЕ")

                                                                query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND Адрес Like '%" + param[2] + "%'";

                                                            else

                                                                if (param[0] != "ВСЕ" && param[1] == "ВСЕ" && param[2] != "ВСЕ" && param[3] != "ВСЕ")

                                                                    query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND Адрес Like '%" + param[2] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                                                                else

                                                                    if (param[0] != "ВСЕ" && param[1] != "ВСЕ" && param[2] == "ВСЕ" && param[3] == "ВСЕ")

                                                                        query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND Полис Like '%" + param[1] + "%'";

                                                                    else

                                                                        if (param[0] != "ВСЕ" && param[1] != "ВСЕ" && param[2] == "ВСЕ" && param[3] != "ВСЕ")

                                                                            query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND Полис Like '%" + param[1] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                                                                        else

                                                                            if (param[0] != "ВСЕ" && param[1] != "ВСЕ" && param[2] != "ВСЕ" && param[3] == "ВСЕ")

                                                                                query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND Полис Like '%" + param[1] + "%' AND Адрес Like '%" + param[2] + "%'";

                                                                            else

                                                                                query = "SELECT * From Patients where Фамилия Like '%" + param[0] + "%' AND Полис Like '%" + param[1] + "%' AND Адрес Like '%" + param[2] + "%' AND [Дата рождения] <= #31/12/" + Convert.ToInt32(param[3]) + "# AND [Дата рождения] >= #01/01/" + Convert.ToInt32(param[3]) + "#";

                }

                data = sql.Query(query);

                sql.Disconnect();

                return data;

            }

            catch (Exception e)

            {

                MessageBox.Show(e.Message);

                return null;

            }

        }

 

        public void Query(string query)

        {

            try

            {

                sql.Connect();

                sql.SetCommand(query);

                sql.Disconnect();

            }

            catch (Exception e)

            {

                MessageBox.Show(e.Message);

            }

        }

 

        OleDbConnection cnt;

        OleDbCommand cmd;

        OleDbDataAdapter da;

        private string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = db.mdb";

 

        public void registration(string F, string I, string O, string time, string P, string A, string Pass)

        {

            cnt = new OleDbConnection(ConnectionString);

            cnt.Open();

            cmd = new OleDbCommand("SELECT MAX(ID) FROM Autorization", cnt);

            OleDbDataReader myOleDbDataReader = cmd.ExecuteReader();

            myOleDbDataReader.Read();

            int ID;

            try

            {

                ID = (myOleDbDataReader.GetInt32(0) + 1);

            }

            catch

            {

                ID = 1;

            }

            myOleDbDataReader.Close();

            DateTime date = DateTime.ParseExact(time, "yyyy/MM/dd", CultureInfo.InvariantCulture);

            /*добавление в таблицу patient*/

            cmd = new OleDbCommand("INSERT INTO [Patients] ([ID],[Фамилия],[Имя],[Отчество],[Дата Рождения],[Полис],[Адрес]) VALUES (@a,@b,@c,@d,@g,@e,@f)", cnt);

            cmd.Parameters.Add("@a", OleDbType.Integer, 100000000, "ID").Value = ID;

            cmd.Parameters.Add("@b", OleDbType.VarChar, 50, "Фамилия").Value = F;

            cmd.Parameters.Add("@c", OleDbType.VarChar, 50, "Имя").Value = I;

            cmd.Parameters.Add("@d", OleDbType.VarChar, 50, "Отчество").Value = O;

            cmd.Parameters.Add("@g", OleDbType.DBDate, 50, "Дата Рождения").Value = date.Date;

            cmd.Parameters.Add("@e", OleDbType.Integer, 100000000, "Полис").Value = Convert.ToInt32(P);

            cmd.Parameters.Add("@f", OleDbType.VarChar, 100, "Адрес").Value = Pass;

            cmd.ExecuteNonQuery();

 

            /*добавление в таблицу autorization*/

            cmd = new OleDbCommand("INSERT INTO [Autorization] ([ID],[Pass]) VALUES (@a,@b)", cnt);

            cmd.Parameters.Add("@a", OleDbType.Integer, 100000000, "ID").Value = ID;

            cmd.Parameters.Add("@b", OleDbType.VarChar, 50, "Name").Value = xor(F, Pass);

            cmd.ExecuteNonQuery();

 

            cmd.Dispose();

            cnt.Close();

            MessageBox.Show("Данные успешно внесены в базу поликлинники. \n" + "Логин: " + ID.ToString() + "\n" + "Пароль:" + Pass, "Обновление", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

        }

 

        private string xor(string key, string shifr)

        {

            string deshifr = "";

            int j = 0;

            for (int i = 0; i < shifr.Length; i++)

            {

                if (j == key.Length)

                    j = 0;

                deshifr += Convert.ToChar(Convert.ToInt32(shifr[i]) ^ Convert.ToInt32(key[j]));

                j++;

            }

            return deshifr;

        }

 

        public DataTable doQuery(string query)

        {

            cnt = new OleDbConnection(ConnectionString);

            cnt.Open();

            cmd = new OleDbCommand(query, cnt);

            da = new OleDbDataAdapter();

            da.SelectCommand = cmd;

            DataTable dt = new DataTable();

            try

            {

                da.Fill(dt);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

                dt = null;

            }

            cnt.Close();

            cmd.Dispose();

            da.Dispose();

            return dt;

        }

 

        public void priem_to_doc(int ID_doc, DateTime time)

        {

            cnt = new OleDbConnection(ConnectionString);

            cnt.Open();

            cmd = new OleDbCommand("SELECT MAX(ID) FROM Талоны", cnt);

            OleDbDataReader myOleDbDataReader = cmd.ExecuteReader();

            myOleDbDataReader.Read();

            int ID;

            try

            {

                ID = (myOleDbDataReader.GetInt32(0) + 1);

            }

            catch

            {

                ID = 1;

            }

            myOleDbDataReader.Close();

            MessageBox.Show(time.ToString());

            /*добавление в таблицу patient*/

            cmd = new OleDbCommand("INSERT INTO [Талоны] ([ID],[ID_doc],[Время]) VALUES (@a,@b,@c)", cnt);

            cmd.Parameters.Add("@a", OleDbType.Integer, 100000000, "ID").Value = ID;

            cmd.Parameters.Add("@b", OleDbType.Integer, 50, "ID_doc").Value = ID_doc;

            cmd.Parameters.Add("@c", OleDbType.DBTimeStamp, 50, "Время").Value = time;

            cmd.ExecuteNonQuery();

            cmd.Dispose();

            cnt.Close();

        }

    }

}

 

Doctors.cs

using System;

using System.Collections.Generic;

using System.Text;

using System.Data;

using System.Windows.Forms;

 

namespace Admin

{

    class Doctors

    {

        private SQL sql;

        public Doctors()

        {

            sql = new SQL();

        }

 

        public DataTable DoctorsData(string[] param)

        {

            try

            {

                DataTable data = new DataTable("Doctors");

                sql.Connect();

                string query = "Select * From Doctors Where ID=" + param[0];

                if (param.Length > 1)

                {

                    if (param[0] == "ВСЕ" && param[1] == "ВСЕ" && param[2] == "ВСЕ")

                        query = "SELECT * From Doctors";

                    else

                        if (param[0] == "ВСЕ" && param[1] == "ВСЕ" && param[2] != "ВСЕ")

                            query = "SELECT * From Doctors where Профессия Like '%" + param[2] + "%'";

                        else

                            if (param[0] == "ВСЕ" && param[1] != "ВСЕ" && param[2] == "ВСЕ")

                                query = "SELECT * From Doctors where Статус Like '%" + param[1] + "%'";

                            else

                                if (param[0] == "ВСЕ" && param[1] != "ВСЕ" && param[2] != "ВСЕ")

                                    query = "SELECT * From Doctors where Статус Like '%" + param[1] + "%' AND Профессия Like '%" + param[2] + "%'";

                                else

                                    if (param[0] != "ВСЕ" && param[1] == "ВСЕ" && param[2] == "ВСЕ")

                                        query = "SELECT * From Doctors where Фамилия Like '%" + param[0] + "%'";

                                    else

                                        if (param[0] != "ВСЕ" && param[1] == "ВСЕ" && param[2] != "ВСЕ")

                                            query = "SELECT * From Doctors where Фамилия Like '%" + param[0] + "%' AND Профессия Like '%" + param[2] + "%'";

                                        else

                                            if (param[0] != "ВСЕ" && param[1] != "ВСЕ" && param[2] == "ВСЕ")

                                                query = "SELECT * From Doctors where Фамилия Like '%" + param[0] + "%' AND Статус Like '%" + param[1] + "%'";

                                            else

                                                query = "SELECT * From Doctors where Фамилия Like '%" + param[0] + "%' AND Статус Like '%" + param[1] + "%' AND Профессия Like '%" + param[2] + "%'";

                }

                data = sql.Query(query);

                sql.Disconnect();

Информация о работе Программирование