Beispiel #1
0
        public VisitViewercs(int ID, TextBox text) : this()
        {
            listView1.FullRowSelect = true;
            listView1.GridLines     = true;
            patid = ID;
            textb = text;
            var res = SQLLab.GetPatientData(patid);

            foreach (var order in res)
            {
                textBox1.Text = order.PESEL;
            }

            docs = SQLAdm.GetStaff("", "", "", "doc");
            foreach (var order in docs)
            {
                comboBox3.Items.Add(order.Surname);
            }

            listView1.Items.Clear();

            var temp = SQLRec.GetApo(patid);

            foreach (var order in temp)
            {
                ListViewItem lvi  = new ListViewItem(order.Id_Appointment.ToString());
                var          tmp  = SQLRec.GetDocData(order.Id_Doctor);
                string       name = tmp.FirstOrDefault().Name + " " + tmp.FirstOrDefault().Surname;
                lvi.SubItems.Add(name);
                lvi.SubItems.Add(order.Date_Appointment.ToString());
                lvi.SubItems.Add(SQLRec.translateRolePL(order.State.ToString()));

                listView1.Items.Add(lvi);
            }
        }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {//zapisz i zamknij
            if (comboBox1.Text != "" && comboBox2.Text != "")
            {
                var doc = docs.AsEnumerable <Staff>();

                int    docid   = doc.ElementAt <Staff>(comboBox1.SelectedIndex).Id_Staff;
                string culture = "mn-MN";
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);

                string datetosql = monthCalendar1.SelectionStart.ToShortDateString();
                datetosql += " " + comboBox2.Text;
                DateTime dt = DateTime.Parse(datetosql);
                {
                    SQLRec.updateApo(apoid, SQLRec.translateRoleDB(comboBox3.Text.ToString()), docid, dt);
                }

                this.Controls.Clear();
                this.Visible = false;
                this.Parent.Hide();

                textb.Text = "changed";
            }
            else
            {
                MessageBox.Show("Wprowadz poprawne informacje");
            }
        }
Beispiel #3
0
        private void reload()
        {
            var doc = docs.AsEnumerable <Staff>();

            if (dateTimePicker1.Checked == true)
            {
                if (comboBox3.SelectedIndex >= 0)
                {
                    int docid = doc.ElementAt <Staff>(comboBox3.SelectedIndex).Id_Staff;
                    var temp  = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()), docid, datetostring());
                    listupdate(temp);
                }
                else
                {
                    var temp = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()), datetostring());
                    listupdate(temp);
                }
            }

            else
            {
                if (comboBox3.SelectedIndex >= 0)
                {
                    int docid = doc.ElementAt <Staff>(comboBox3.SelectedIndex).Id_Staff;
                    var temp  = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()), docid);
                    listupdate(temp);
                }
                else
                {
                    var temp = SQLRec.GetApo(patid, SQLRec.translateRoleDB(comboBox1.Text.ToString()));
                    listupdate(temp);
                }
            }
        }
Beispiel #4
0
        public Edit(int ID, TextBox text) : this()
        {
            apoid = ID;
            textb = text;

            var a = SQLRec.GetApoSE(apoid);
            //comboBox4.drop

            var res = SQLLab.GetPatientData(a.First().Id_Patient);

            foreach (var order in res)
            {
                textBox1.Text = order.Name;
                textBox2.Text = order.Surname;
                textBox3.Text = order.PESEL;
            }
            docs = SQLAdm.GetStaff("", "", "", "doc");
            foreach (var order in docs)
            {
                comboBox1.Items.Add(order.Surname);
            }

            var doc = SQLAdm.GetStaff(a.First().Id_Doctor);

            comboBox1.Text = doc.First().Name.ToString();                        //lekarz
            monthCalendar1.SetDate(a.First().Date_Appointment);                  //data
            comboBox3.Text = SQLRec.translateRolePL(a.First().State.ToString()); //stan
            //string time = a.First().Date_Appointment.Hour.ToString()+":" + a.First().Date_Appointment.Minute.ToString();
            string time = a.First().Date_Appointment.ToString("HH:mm");

            comboBox2.Text = time;//godzina

            // comboBox4.DropDownStyle = ComboBoxStyle.DropDownList;
            // comboBox2.Text = a.First().Date_Appointment.TimeOfDay.ToString();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex != -1 && comboBox2.SelectedIndex != -1)
            {
                string culture = "mn-MN";
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
                string datetosql = monthCalendar1.SelectionStart.ToShortDateString();
                datetosql += " " + comboBox2.Text;

                var doc = docs.AsEnumerable <Staff>();

                int docid = doc.ElementAt <Staff>(comboBox1.SelectedIndex).Id_Staff;

                DateTime dt = DateTime.Parse(datetosql);

                SQLRec.ExecuteAppointment(dt, docid, idrec, "", "", patid, "R");//zamiast 1 idrec
                this.Controls.Clear();
                this.Visible = false;
                this.Parent.Hide();

                textb.Text = "changed";
            }
            else
            {
                MessageBox.Show("Wybierz doktora oraz dane wizyty");
            }
        }
Beispiel #6
0
        private void refresh()
        {
            listView1.Items.Clear();
            var res = SQLRec.GetPatientsList(textBox1.Text, textBox2.Text, textBox3.Text);

            foreach (var order in res)
            {
                ListViewItem lvi = new ListViewItem(order.Name.ToString());
                lvi.SubItems.Add(order.Surname);
                lvi.SubItems.Add(order.PESEL);
                listView1.Items.Add(lvi);
            }
        }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();
            var res = SQLRec.GetPatientsList(textBox1.Text, textBox2.Text, textBox3.Text);

            foreach (var order in res)
            {
                ListViewItem lvi = new ListViewItem(order.Name.ToString());
                lvi.SubItems.Add(order.Surname);
                lvi.SubItems.Add(order.PESEL);
                listView1.Items.Add(lvi);
            }
        }
Beispiel #8
0
        private void listupdate(IQueryable <Appointment> temp)
        {
            listView1.Items.Clear();

            foreach (var order in temp)
            {
                ListViewItem lvi  = new ListViewItem(order.Id_Appointment.ToString());
                var          tmp  = SQLRec.GetDocData(order.Id_Doctor);
                string       name = tmp.FirstOrDefault().Name + " " + tmp.FirstOrDefault().Surname;
                lvi.SubItems.Add(name);
                lvi.SubItems.Add(order.Date_Appointment.ToString());
                lvi.SubItems.Add(SQLRec.translateRolePL(order.State.ToString()));

                listView1.Items.Add(lvi);;
            }
        }
Beispiel #9
0
        public Reg()
        {
            InitializeComponent();
            listView1.Items.Clear();
            var res = SQLRec.GetPatientsList("", "", "");

            foreach (var order in res)
            {
                ListViewItem lvi = new ListViewItem(order.Name.ToString());
                lvi.SubItems.Add(order.Surname);
                lvi.SubItems.Add(order.PESEL);
                listView1.Items.Add(lvi);
            }
            listView1.FullRowSelect = true;
            listView1.GridLines     = true;
        }
Beispiel #10
0
        private void button4_Click(object sender, EventArgs e)//show
        {
            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = listView1.SelectedItems[0];


                var res = SQLRec.GetPatientsList(item.SubItems[0].Text.TrimEnd(), item.SubItems[1].Text.TrimEnd(), item.SubItems[2].Text.TrimEnd());
                foreach (var x in res)
                {
                    WindowPanel.Controls.Add(new VisitViewercs(x.Id_Patient, connector));
                    WindowPanel.Visible = true;
                    WindowPanel.Dock    = DockStyle.Fill;
                    WindowPanel.BringToFront();
                }
            }
        }
Beispiel #11
0
        private void button2_Click(object sender, EventArgs e) //edit
        {
            if (textBox1.TextLength != 0 && textBox2.TextLength != 0 && textBox3.TextLength != 0 && Regex.IsMatch(textBox3.Text.ToString(), @"^(\d{11})$"))
            {
                SQLRec.EditPatient(id, textBox1.Text, textBox2.Text, textBox3.Text);
                MessageBox.Show("Zmieniono dane pacjenta");
                this.Controls.Clear();
                this.Visible = false;
                this.Parent.Hide();

                textb.Text = "changed";
            }
            else
            {
                MessageBox.Show("Brak Danych lub błędny pesel");
            }
        }
Beispiel #12
0
        /// <summary>
        ///  ===== EXAMPLE METHOD 1 ============
        ///  This  method is to be used to validate user access.
        /// </summary>
        /// <param name="CurrentUser"></param>
        /// <returns>
        ///  Returns true for 'granted access' and false for 'denied access'</returns>
        public string CheckuserSecurityAccess(string CurrentUser)
        {
            string ReturnedValue = "false";

            SqlConnection SQLConn = new SqlConnection();
            SqlCommand    SQLComm = new SqlCommand();
            SqlDataReader SQLRec;

            //connection string to the database
            SQLConn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["EmployeeDataBaseConnectionString"].ConnectionString;

            //open connection
            SQLConn.Open();

            //stored procedure name
            string SQL = "ssp_tblOperator_GetUserAccess";

            SQLComm             = new SqlCommand(SQL, SQLConn);
            SQLComm.CommandType = CommandType.StoredProcedure;

            //parameter passed
            SQLComm.Parameters.AddWithValue("@CurrentUser", CurrentUser);

            SQLRec = SQLComm.ExecuteReader();

            try
            {
                if (SQLRec.Read())
                {
                    //returned results
                    ReturnedValue = SQLRec.GetString(SQLRec.GetOrdinal("UserHasAccess"));
                }
            }
            catch (Exception e)
            {
                ReturnedValue = e.Message;
            }

            //close connection
            SQLRec.Close();
            SQLConn.Close();

            return(ReturnedValue);
        }
Beispiel #13
0
        /// <summary>
        /// ===== EXAMPLE METHOD 2 ============
        /// </summary>
        /// This method is to be used to return a list of employee information.
        /// <returns>
        ///  A list of employee information
        /// </returns>
        public List <SampleEmployeeDataModel> GetCodeSampleList()
        {
            List <SampleEmployeeDataModel> SampleDataModel = new List <SampleEmployeeDataModel>();

            SqlConnection SQLconn = new SqlConnection();
            SqlCommand    SQLcomm = new SqlCommand();
            SqlDataReader SQLRec;

            //connection string to the database
            SQLconn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["EmployeeDataBaseConnectionString"].ConnectionString;

            //open connection
            SQLconn.Open();

            //stored procedure name
            string SQL = "ssp_tblEmployee_GetEmployeeInformationList";

            SQLcomm             = new SqlCommand(SQL, SQLconn);
            SQLcomm.CommandType = CommandType.StoredProcedure;

            SQLRec = SQLcomm.ExecuteReader();

            //read data into the model
            while (SQLRec.Read())
            {
                SampleDataModel.Add(new SampleEmployeeDataModel
                {
                    ID        = SQLRec.GetInt32(SQLRec.GetOrdinal("ID")),
                    FirstName = SQLRec.GetString(SQLRec.GetOrdinal("FirstName")),
                    LastName  = SQLRec.GetString(SQLRec.GetOrdinal("LastName")),
                    DOB       = SQLRec.GetDateTime(SQLRec.GetOrdinal("DOB")),
                    SSN       = SQLRec.GetString(SQLRec.GetOrdinal("SSN")),
                });
            }

            //close connection
            SQLRec.Close();
            SQLconn.Close();

            return(SampleDataModel);
        }
Beispiel #14
0
        private void button3_Click(object sender, EventArgs e)//visit registarion
        {
            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = listView1.SelectedItems[0];


                var res = SQLRec.GetPatientsList(item.SubItems[0].Text.TrimEnd(), item.SubItems[1].Text.TrimEnd(), item.SubItems[2].Text.TrimEnd());
                foreach (var x in res)
                {
                    WindowPanel.Controls.Add(new VisitRegistration(x.Id_Patient, connector, whoami));
                    WindowPanel.Visible = true;
                    WindowPanel.Dock    = DockStyle.Fill;
                    WindowPanel.BringToFront();
                }
            }
            else
            {
                MessageBox.Show("Nie wybrano pacjenta");
            }
        }
Beispiel #15
0
        public Show(int ID, TextBox text) : this()
        {
            apoid = ID;
            textb = text;

            var a = SQLRec.GetApoSE(apoid);


            var res = SQLLab.GetPatientData(a.First().Id_Patient);

            foreach (var order in res)
            {
                textBox1.Text = order.Name;
                textBox2.Text = order.Surname;
                textBox3.Text = order.PESEL;
            }
            var doc = SQLAdm.GetStaff(a.First().Id_Doctor);

            textBox4.Text = doc.First().Name.ToString();                        //lekarz

            textBox7.Text = a.First().Date_Appointment.ToString();              //data
            textBox6.Text = SQLRec.translateRolePL(a.First().State.ToString()); //stan
            string time = a.First().Date_Appointment.TimeOfDay.ToString();
        }