Esempio n. 1
0
 private void Dosages_FormClosing(object sender, FormClosingEventArgs e)
 {
     var cl = new DrugDispatch();
     cl.UpdateDosageTable(dsMaster1.DOSAGES);
 }
Esempio n. 2
0
        private void Dosages_Load(object sender, EventArgs e)
        {
            var cl = new DrugDispatch();
            dsMaster1.Merge(cl.GetDosagesDataTable());

        }
Esempio n. 3
0
 void DoSave()
 {
     if (patname.EditValue == null)
     {
         XtraMessageBox.Show("Please enter the patient name", "POS", MessageBoxButtons.OK,
             MessageBoxIcon.Information);
         return;
     }
     if (hospname.EditValue == null)
     {
         XtraMessageBox.Show("Please enter the hosipital name", "POS", MessageBoxButtons.OK,
             MessageBoxIcon.Information);
         return;
     }
     if (lookupcashier.EditValue == null)
     {
         XtraMessageBox.Show("Please  doctor not found", "POS", MessageBoxButtons.OK,
             MessageBoxIcon.Information);
         return;
     }
     if (voudate.EditValue == null)
     {
         XtraMessageBox.Show("Please enter the date", "POS", MessageBoxButtons.OK,
             MessageBoxIcon.Information);
         return; 
     }
     if (dsMaster1.DDDETAILS.Rows.Count == 0)
     {
         XtraMessageBox.Show("Nothing to save", "POS", MessageBoxButtons.OK,
             MessageBoxIcon.Information);
         return;
     }
     gridView1.PostEditor();
     gridView1.UpdateCurrentRow();
     var dr = (DsMaster.DDMASTRow) dsMaster1.DDMAST.NewRow();
     dr.DNO = _dosageno;
     dr.PATNAME = patname.Text;
     dr.HOSPITAL = hospname.Text;
     dr.COMP = Utils.Company;
     dr.TDATE = voudate.DateTime.Date;
     if(lookupcashier.EditValue!=null)
          dr.DOCTOR = int.Parse(lookupcashier.EditValue.ToString());
     var bhl = new DrugDispatch();
     dDDETAILSBindingSource.EndEdit();
     var changes = (DsMaster.DDDETAILSDataTable)dsMaster1.DDDETAILS.GetChanges(DataRowState.Modified | DataRowState.Added);
     try
     {
         var strstatus = bhl.DoSaveDrugDispatch(dr, dsMaster1.DDDETAILS);
         if (strstatus == "1")
         {
             _dosageno = Utils.DosageNo;
             txtvocherno.Text = _dosageno;
             XtraMessageBox.Show("Data Saved Sucessfully", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
             foreach (DataRow d in dsMaster1.DDDETAILS.Rows)
             {
                 if (d.RowState != DataRowState.Deleted)
                 {
                     d["DNO"] = _dosageno;
                 }
             }
             var addedRows = from row in dsMaster1.DDDETAILS
                             where row.RowState == DataRowState.Added
                             select row;
             foreach (var row in addedRows.ToArray())
             {
                 row.Delete();
             }
             if (changes != null) dsMaster1.Merge(changes);
             dsMaster1.AcceptChanges();
         }
         else
         {
             XtraMessageBox.Show(strstatus, "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString());
     }
 }