예제 #1
0
        private void btnApprove_Click(object sender, EventArgs e)
        {
            try
            {
                if (objMR != null)
                {
                    DialogResult dr = MessageBox.Show(this, "Are you sure you want to Approve selected Material Requisition?\n\nClick yes to Approve", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                    if (dr == DialogResult.Yes)
                    {
                        objMR.MRStatus     = MR.Status.Approved;
                        objMR.MRApprovedBy = CurrentUser.UserEmp.EmployeeID;
                        int x = objMRDL.Update_Approve(objMR);
                        if (x > 0)
                        {
                            MessageBox.Show(this, "Material Requition Approved", "Aproved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Clear();
                        }
                    }
                }
                else
                {
                    MessageBox.Show(this, "Please select a MR before click Approve", "Select a MR", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnReject_Click(object sender, EventArgs e)
        {
            try
            {
                if (objMR != null)
                {
                    DialogResult dr = MessageBox.Show(this, "Are you sure you want to Reject selected MR?\n\nClick yes to reject", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr == DialogResult.Yes)
                    {
                        objMR.MRStatus     = MR.Status.Reject;
                        objMR.MRApprovedBy = CurrentUser.UserEmp.EmployeeID;
                        int x = objMRDL.Update_Approve(objMR);
                        if (x > 0)
                        {
                            MessageBox.Show(this, "Material Requition Rejected", "Rejected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Clear();

                            Store objStore = (Store)cmbStore.SelectedItem;

                            if (objStore != null)
                            {
                                bindMRList.DataSource = objMRDL.GetDataView(objStore.StoreID, MR.Status.Approved);

                                if (objMRDL.GetDataView(objStore.StoreID, MR.Status.Approved).Rows.Count == 0)
                                {
                                    gvItemList.AutoGenerateColumns = false;
                                    bindItemList.DataSource        = null;
                                    gvItemList.DataSource          = bindItemList;
                                    bindItemList.ResetBindings(true);
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(this, "Please select a MR before click Reject", "Select a MR", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }