예제 #1
0
 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
 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
        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
        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
        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);
            }
        }