Esempio n. 1
0
        private void SetADForUpdate(Assignment assignDetail)
        {
            textBoxAssignID.Text = assignDetail.AssignID.ToString();
            textBoxPatientID.Text = assignDetail.PatientID.ToString();
            dateCreate.Value = assignDetail.Date;
            dateDischarge.Value = assignDetail.DischargedDate;
            dateHospitalize.Value = assignDetail.HospitalizateDate;

            dateHospitalize.Enabled = false;

            DataTable dtStaff = Staff.GetListStaff();
            for (int i = 0; i < dtStaff.Rows.Count; i++)
            {
                String staffName = dtStaff.Rows[i][6].ToString() + " " + dtStaff.Rows[i][5].ToString();
                Staff newStaff = Staff.GetStaff(Convert.ToInt32(dtStaff.Rows[i][0]));
                listStaff.Add(newStaff);
                listBoxSystemStaff.Items.Add(staffName);
            }
            listBoxSystemStaff.SelectedIndex = 0;

            DataTable dtAD = AssignmentDetail.GetListAssignmentDetails(assignDetail.AssignID);
            for (int i = 0; i < dtAD.Rows.Count; i++)
            {
                String staffName = dtAD.Rows[i][2].ToString() + " " + dtAD.Rows[i][3].ToString();
                AssignmentDetail newAD = new AssignmentDetail();
                newAD.AssignID = Convert.ToInt32(dtAD.Rows[i][0]);
                newAD.StaffID = Convert.ToInt32(dtAD.Rows[i][1]);
                listAD.Add(newAD);
                listBoxCurrentStaff.Items.Add(staffName);
            }
            if (listBoxCurrentStaff.Items.Count > 0)
                listBoxCurrentStaff.SelectedIndex = 0;
        }
Esempio n. 2
0
 public static int DeleteAssignmentDetails(AssignmentDetail deleteAD)
 {
     string sqlDelete = @"DELETE FROM ASSIGNMENTDETAIL
                         WHERE        (ASSIGNID=@ASSIGNID AND STAFFID=@STAFFID)";
     SqlParameter[] sqlParameters = { new SqlParameter("@ASSIGNID", deleteAD.AssignID),
                                          new SqlParameter("@STAFFID", deleteAD.StaffID)};
     return SqlResult.ExecuteNonQuery(sqlDelete, sqlParameters);
 }
Esempio n. 3
0
 public static int  InsertAssignmentDetails(AssignmentDetail newAD)
 {
     String sqlInsert = @"INSERT INTO ASSIGNMENTDETAIL(ASSIGNID, STAFFID)
                         VALUES        (@ASSIGNID,@STAFFID)";
     SqlParameter[] sqlParameters = { new SqlParameter("@ASSIGNID", newAD.AssignID),
                                     new SqlParameter("@STAFFID", newAD.StaffID)};
     return SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters);
 }
Esempio n. 4
0
        public static int DeleteAssignmentDetails(AssignmentDetail deleteAD)
        {
            string sqlDelete = @"DELETE FROM ASSIGNMENTDETAIL
                                WHERE        (ASSIGNID=@ASSIGNID AND STAFFID=@STAFFID)";

            SqlParameter[] sqlParameters = { new SqlParameter("@ASSIGNID", deleteAD.AssignID),
                                             new SqlParameter("@STAFFID",  deleteAD.StaffID) };
            return(SqlResult.ExecuteNonQuery(sqlDelete, sqlParameters));
        }
Esempio n. 5
0
        public static int  InsertAssignmentDetails(AssignmentDetail newAD)
        {
            String sqlInsert = @"INSERT INTO ASSIGNMENTDETAIL(ASSIGNID, STAFFID)
                                VALUES        (@ASSIGNID,@STAFFID)";

            SqlParameter[] sqlParameters = { new SqlParameter("@ASSIGNID", newAD.AssignID),
                                             new SqlParameter("@STAFFID",  newAD.StaffID) };
            return(SqlResult.ExecuteNonQuery(sqlInsert, sqlParameters));
        }
Esempio n. 6
0
 private void buttonInsertFunction_Click(object sender, EventArgs e)
 {
     int selectedStaff = listBoxSystemStaff.SelectedIndex;
     if (CheckStaffInAssign(listStaff[selectedStaff].StaffID))
     {
         MessageBox.Show("Nhân viên đã có trong danh sách phân công chăm sóc bệnh nhân", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         AssignmentDetail newAD = new AssignmentDetail(0, listStaff[selectedStaff].StaffID);
         listAD.Add(newAD);
         listBoxCurrentStaff.Items.Add(listBoxSystemStaff.Items[selectedStaff].ToString());
         listBoxCurrentStaff.SelectedIndex = 0;
     }
 }