Пример #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            fReturn frm = new fReturn();

            frm.ItemChanged = RefReshList;
            frm.ShowDlg(new Return());
        }
Пример #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                int[]       selRows     = ((GridView)grdReturns.MainView).GetSelectedRows();
                DataRowView oReturnD    = (DataRowView)(((GridView)grdReturns.MainView).GetRow(selRows[0]));
                DataRowView oReturnDate = (DataRowView)(((GridView)grdReturns.MainView).GetRow(selRows[0]));

                int      nReturnID   = Convert.ToInt32(oReturnD["ID"]);
                DateTime dReturnDate = Convert.ToDateTime(oReturnDate["ReturnDate"]);

                Return oReturn = db.Returns.FirstOrDefault(p => p.ReturnID == nReturnID);

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

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

                fReturn frm = new fReturn();
                frm.ItemChanged = RefReshList;
                frm.ShowDlg(oReturn);
            }
        }