Пример #1
0
        private void btnMoneyReceipt_Click(object sender, EventArgs e)
        {
            try
            {
                int[]       selRows           = ((GridView)grdCashCollections.MainView).GetSelectedRows();
                DataRowView oCashCollectionID = (DataRowView)(((GridView)grdCashCollections.MainView).GetRow(selRows[0]));
                DataRowView oCollDate         = (DataRowView)(((GridView)grdCashCollections.MainView).GetRow(selRows[0]));

                int      nCashCollectionID = Convert.ToInt32(oCashCollectionID["CashCollectionID"]);
                DateTime CollDate          = Convert.ToDateTime(oCollDate["EntryDate"]);

                CashCollection oCashCollection = db.CashCollections.FirstOrDefault(p => p.CashCollectionID == nCashCollectionID);

                if (oCashCollection == null)
                {
                    MessageBox.Show("select an item ", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }


                fCashCollection obj = new fCashCollection();
                obj.MoneyReceipt(oCashCollection);
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Cannot generate Money Receipt due to " + Ex.Message);
            }
        }
Пример #2
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     try
     {
         fCashCollection frm = new fCashCollection();
         frm.ItemChanged = RefreshList;
         frm.ShowDlg(new CashCollection(), false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                int[]       selRows           = ((GridView)grdCashCollections.MainView).GetSelectedRows();
                DataRowView oCashCollectionID = (DataRowView)(((GridView)grdCashCollections.MainView).GetRow(selRows[0]));
                DataRowView oCollDate         = (DataRowView)(((GridView)grdCashCollections.MainView).GetRow(selRows[0]));

                int      nCashCollectionID = Convert.ToInt32(oCashCollectionID["CashCollectionID"]);
                DateTime CollDate          = Convert.ToDateTime(oCollDate["EntryDate"]);

                CashCollection oCashCollection = db.CashCollections.FirstOrDefault(p => p.CashCollectionID == nCashCollectionID);

                if (oCashCollection == null)
                {
                    MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (Global.CurrentUser.ISEditable == 1)
                {
                    if (CollDate < DateTime.Today)
                    {
                        MessageBox.Show("This Item can't be editable, Please contact BD Team", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }

                fCashCollection frm = new fCashCollection();
                frm.ItemChanged = RefreshList;
                frm.ShowDlg(oCashCollection, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }