Esempio n. 1
0
 private void ComboDocNo_TextChanged(object sender, EventArgs e)
 {
     FormatBtnUpdate(ComboDocNo, TxtDocNo, ComboLocation, ComboDoctor, TxtAmount, TxtDesc);
     FormatBtnDelete(ComboDocNo);
     // Loading data into the form
     try
     {
         using (DBAuditDataContext dc = new DBAuditDataContext())
         {
             if (ComboDocNo.Text != "")
             {
                 string   StrDocNo              = null;
                 DateTime?VarDatePay            = null;
                 string   StrLocation           = null;
                 string   StrDoctor             = null;
                 decimal? DecimalAmount         = null;
                 decimal? DecimalPercent        = null;
                 decimal? DecimalTaxs           = null;
                 decimal? DecimalDiscounts      = null;
                 decimal? DecimalTotalDiscounts = null;
                 decimal? DecimalNetAmount      = null;
                 string   StrDetails            = null;
                 string   StrNotes              = null;
                 var      c = dc.ProSelectDoctorBill(ComboDocNo.Text, ref StrDocNo, ref VarDatePay, ref StrLocation, ref StrDoctor, ref DecimalAmount, ref DecimalPercent, ref DecimalTaxs, ref DecimalDiscounts, ref DecimalTotalDiscounts, ref DecimalNetAmount, ref StrDetails, ref StrNotes);
                 TxtDocNo.Text = StrDocNo;
                 if (VarDatePay != null)
                 {
                     DatePayDate.Value = VarDatePay.Value;
                 }
                 ComboLocation.Text    = StrLocation;
                 ComboDoctor.Text      = StrDoctor;
                 TxtAmount.Text        = DecimalAmount.ToString();
                 TxtPercent.Text       = DecimalPercent.ToString();
                 TxtTaxs.Text          = DecimalTaxs.ToString();
                 TxtDiscounts.Text     = DecimalDiscounts.ToString();
                 TxtTotalDiscount.Text = DecimalTotalDiscounts.ToString();
                 TxtNetAmount.Text     = DecimalNetAmount.ToString();
                 TxtDesc.Text          = StrDetails;
                 TxtNotes.Text         = StrNotes;
             }
         }
     }
     catch (NullReferenceException)
     {
     }
     catch (InvalidOperationException)
     {
         TxtDocNo.Text         = "";
         DatePayDate.Value     = DateTime.Now;
         ComboLocation.Text    = "";
         ComboDoctor.Text      = "";
         TxtAmount.Text        = "";
         TxtPercent.Text       = "";
         TxtTaxs.Text          = "";
         TxtDiscounts.Text     = "";
         TxtTotalDiscount.Text = "";
         TxtNetAmount.Text     = "";
         TxtDesc.Text          = "";
         TxtNotes.Text         = "";
         BtnDelete.Enabled     = false;
     }
     catch (Exception EX)
     {
         MessageBox.Show(EX.Message);
     }
 }