コード例 #1
0
ファイル: PaymentsCtrl.cs プロジェクト: robarkins/Newcourt
 private void GetRecords()
 {
     try {
         Cursor.Current       = Cursors.WaitCursor;
         bsRecords.DataSource = Data_PaymentStaging.GetPaymentStagingByUsername(Global.Username);
     } catch (Exception ex) {
         Utils.ShowException(ex);
     } finally {
         Cursor.Current = Cursors.Default;
     }
 }
コード例 #2
0
ファイル: PaymentsCtrl.cs プロジェクト: robarkins/Newcourt
 private void btnClear_Click(object sender, EventArgs e)
 {
     try {
         if (grdRecords.RowCount > 0 && Utils.AskQuestion("You you sure you want to clear all Payments?") == DialogResult.Yes)
         {
             Data_PaymentStaging.DeleteAllPaymentStaging(Global.Username);
             GetRecords();
         }
     } catch (Exception ex) {
         Utils.ShowException(ex);
     }
 }
コード例 #3
0
ファイル: PaymentsCtrl.cs プロジェクト: robarkins/Newcourt
        private void grdRecords_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            try {
                Data_PaymentStaging payment = grdRecords.Rows[e.RowIndex].DataBoundItem as Data_PaymentStaging;

                if (payment != null)
                {
                    Data_PaymentStaging.SavePaymentStaging(payment);
                }
            } catch (Exception ex) {
                Utils.ShowException(ex);
            }
        }
コード例 #4
0
ファイル: PaymentsCtrl.cs プロジェクト: robarkins/Newcourt
        private void SavePaymentStaging()
        {
            try {
                List <Data_PaymentStaging> payments = bsRecords.DataSource as List <Data_PaymentStaging>;

                if (payments != null)
                {
                    Data_PaymentStaging.SavePaymentStaging(Global.Username, payments);
                }
            } catch (Exception ex) {
                Utils.ShowException(ex);
            }
        }
コード例 #5
0
ファイル: PaymentsCtrl.cs プロジェクト: robarkins/Newcourt
        private void DeleteFromPaymentStaging()
        {
            try {
                if (grdRecords.RowCount > 0 && Utils.AskQuestion("Are you sure you want to delete this Payment?") == DialogResult.Yes)
                {
                    Data_PaymentStaging payment = Utils.GetCurrentRecord <Data_PaymentStaging>(bsRecords);

                    if (payment != null)
                    {
                        Data_PaymentStaging.DeleteFromPaymentStaging(payment.Username, payment.SuppplierId);
                        GetRecords();
                    }
                }
            } catch (Exception ex) {
                Utils.ShowException(ex);
            }
        }
コード例 #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                List <Data_PaymentStaging> staging = new List <Data_PaymentStaging>();

                foreach (DataGridViewRow i in grdSuppliers.Rows)
                {
                    DataGridViewCheckBoxCell cell = i.Cells["Selected"] as DataGridViewCheckBoxCell;

                    bool isSelected = Convert.ToBoolean(cell.Value);

                    if (isSelected)
                    {
                        Data_Supplier supplier = i.DataBoundItem as Data_Supplier;

                        if (supplier != null)
                        {
                            staging.Add(new Data_PaymentStaging()
                            {
                                Username    = Global.Username,
                                SuppplierId = supplier.SupplierID,
                                Amount      = amount
                            });
                        }
                    }
                }

                Data_PaymentStaging.SavePaymentStaging(Global.Username, staging);
                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                Utils.ShowException(ex);
            }
        }