Ejemplo n.º 1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            fPReturn frm = new fPReturn();

            frm.ItemChanged = RefReshList;
            frm.ShowDlg(new Return());
        }
Ejemplo n.º 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            using (DEWSRMEntities db = new DEWSRMEntities())
            {
                int[]       selRows     = ((GridView)grdPReturns.MainView).GetSelectedRows();
                DataRowView oReturnD    = (DataRowView)(((GridView)grdPReturns.MainView).GetRow(selRows[0]));
                DataRowView oReturnDate = (DataRowView)(((GridView)grdPReturns.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;
                    }
                }

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