示例#1
0
        private void EditBillBtn_Click(object sender, EventArgs e)
        {
            try
            {
                int TestParse = 0;

                if (int.TryParse(BillNumberTxtBox.Text, out TestParse))
                {
                    BillNumberTxtBox.BackColor = BillNumberBGColor;
                    if (BillGeneralMgmt.IsBillExist(int.Parse(BillNumberTxtBox.Text)))
                    {
                        DataTable aDataTableToPass = BillDetailedMgmt.SelectBillByBillNumber(int.Parse(BillNumberTxtBox.Text));
                        if (aDataTableToPass == null)
                        {
                            throw new Exception("aDataTableToPass==null");
                        }

                        EditBill aEditBill = new EditBill();
                        aEditBill.TopMost = true;
                        aEditBill.AddDgView(aDataTableToPass);

                        DataRow aGeneralBillDataRow = BillGeneralMgmt.SelectBillByNumber(int.Parse(BillNumberTxtBox.Text));

                        if (aGeneralBillDataRow == null)
                        {
                            aEditBill.Close();
                            throw new Exception("aGeneralBillDataRow==null");
                        }

                        aEditBill.UpdateVariables(aGeneralBillDataRow);
                        aEditBill.Show();

                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(MsgTxt.BillNumberNotExistTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        BillNumberTxtBox.BackColor = SharedVariables.TxtBoxRequiredColor;
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(MsgTxt.ErrorPleaseEnterCorrectAmount, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    BillNumberTxtBox.BackColor = SharedVariables.TxtBoxRequiredColor;
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [EditBillBtn_Click] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
示例#2
0
 private void ListBillsDGView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (PrivilegesManager.GetEventStatues(Calcium_RMS.Events.EditBills) == EventStatus.Permit)
         {
             if (e.RowIndex < 0)
             {
                 return;
             }
             else
             {
                 DataTable aDataTableToPass = BillDetailedMgmt.SelectBillByBillNumber(int.Parse(ListBillsDGView.Rows[e.RowIndex].Cells["Number"].Value.ToString()));
                 if (aDataTableToPass != null)
                 {
                     EditBill aEditBill = new EditBill();
                     //  aEditBill.Parent = Helper.Instance.ActiveMainWindow;
                     aEditBill.AddDgView(aDataTableToPass);
                     DataRow aGeneralBillDataRow = BillGeneralMgmt.SelectBillByNumber(int.Parse(ListBillsDGView.Rows[e.RowIndex].Cells["Number"].Value.ToString()));
                     if (aGeneralBillDataRow != null)
                     {
                         aEditBill.UpdateVariables(aGeneralBillDataRow);
                         aEditBill.Dock = DockStyle.Fill;
                         aEditBill.Show();
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show(MsgTxt.PrivUserNotAllowedTxt, MsgTxt.InformationCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListBills:ListBillsDGView_CellDoubleClick()] \n Exception: \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         //throw;
     }
 }