Example #1
0
 //edit constructor
 public frmPatientsCRUD(frmPatients owner, List <string> parameters, int?patientID, string visitsDetails)
 {
     InitializeComponent();
     cmbxCategoryName.DataSource = Category.getCategories_DropDownList();
     //get values using parameter[0] > patient id في حالة التعديل من شاشة المرضى
     if (parameters.Count > 0)
     {
         frmPatients     = owner;
         this.parameters = parameters;
         details         = new List <string>();
         details         = Details(int.Parse(parameters[0]));
     }
     //في حالة التعديل من شاشة الحجز
     if (patientID.HasValue && visitsDetails == null)
     {
         this.patientID = patientID;
         details        = new List <string>();
         details        = Details(patientID.Value);
         btnCRUD.Text   = "(Enter) تعديل";
     }
     //في حالة عرض تفاصيل المريض في شاشة الزيارات
     if (patientID.HasValue && visitsDetails == "الحجز")
     {
         this.patientID  = patientID;
         details         = new List <string>();
         details         = Details(patientID.Value);
         btnCRUD.Visible = false;
         ValidationMethods.DisapleFormControls(this.Controls);
     }
     if (patientID.HasValue || parameters.Count > 0)
     {
         //assign to controls
         //**wife**//
         cmbxCategoryName.Text  = Category.getCategory_Name_by_ID(details[1]);
         txtWifeName.Text       = details[2];
         txtWifePhone.Text      = details[3];
         txtWifeAge.Text        = details[4];
         txtWifeJob.Text        = details[5];
         dtpWifeBirthDate.Value = DateTime.Parse(details[6]);
         numMarryCurrent.Value  = Convert.ToByte(details[7]);
         numNumOfKids.Value     = Convert.ToByte(details[8]);
         txtAddress.Text        = details[9];
         txtEmail.Text          = details[10];
         chkDidMarry.Checked    = Convert.ToBoolean(details[11]);
         try
         {
             numOldMarryPeriod.Value = Convert.ToByte(details[12]);
         }
         catch (Exception)
         {
             numOldMarryPeriod.Value = 0;
         }
         //**husband**//
         txtHusbandName.Text        = details[13];
         txtHusbandPhone.Text       = details[14];
         numHusbandAge.Value        = Convert.ToByte(details[15]);
         txtHusbandJob.Text         = details[16];
         dtpHusbandBirthDate.Value  = DateTime.Parse(details[17]);
         txtusbandRelation.Text     = details[18];
         txtHusbandEmail.Text       = details[19];
         txtHusbandSmokingType.Text = details[20];
     }
 }
Example #2
0
 public frmPatientsCRUD(frmPatients owner)
 {
     InitializeComponent();
     frmPatients = owner;
     cmbxCategoryName.DataSource = Category.getCategories_DropDownList();
 }