Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (objGRN != null)
                {
                    DialogResult dr = MessageBox.Show(this, "Are you sure you want Approve Selected GRN? Click Yes to Approve", "Confirm Approve", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (dr == DialogResult.Yes)
                    {
                        objGRN = objGRNDL.Get(objGRN.GRNNo);
                        if (objGRN != null && objGRN.GRNStatus == GRN.Status.Initial)
                        {
                            objGRN.GRNApprovedBy = CurrentUser.UserEmp.EmployeeID;
                            int y = objGRNDL.Approve(objGRN);


                            objGRN = null;
                            bindItemList.DataSource = null;
                            bindGRNList.DataSource  = objGRNDL.GetDataView(objStore.StoreID, GRN.Status.Initial);
                        }
                        else
                        {
                            MessageBox.Show(this, "Another user changed the Status of selected GRN", "Action Stoped", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            bindGRNList.DataSource  = objGRNDL.GetDataView(objStore.StoreID, GRN.Status.Initial);
                            bindItemList.DataSource = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void btnGRN_Click(object sender, EventArgs e)
        {
            try
            {
                if (gvItemList.Rows.Count > 0)
                {
                    objGRN.GRNApprovedBy   = "N/A";
                    objGRN.GRNApprovedDate = DateTime.Now;
                    objGRN.GRNDate         = DateTime.Now;
                    objGRN.GRNEnterdBy     = CurrentUser.UserEmp.EmployeeID;
                    objGRN.GRNRPDBatch     = null;
                    objGRN.GRNStatus       = GRN.Status.Initial;
                    objGRN.GRNStore        = objStore;
                    objGRN.GRNCategory     = 1;
                    objGRN.GRNNo           = objGRNDL.Add_Direct(objGRN);
                    if (objGRN.GRNNo > 0)
                    {
                        if (objGRN.GRNType == GRN.Type.Material)
                        {
                            foreach (GRNMaterials obj in objGRNMaterialsCollec)
                            {
                                obj.GRN = objGRN;
                                objGRNMaterialsDL.Add(obj);
                            }
                        }
                        else if (objGRN.GRNType == GRN.Type.BasicProduct)
                        {
                            foreach (GRNBasicProducts obj in objGRNBasicProductCollec)
                            {
                                obj.GRN = objGRN;
                                objGRNBasicProductDL.Add(obj);
                            }
                        }
                        else if (objGRN.GRNType == GRN.Type.FinishProduct)
                        {
                            foreach (GRNFinishProducts obj in objGRNFinishProductCollec)
                            {
                                obj.GRN = objGRN;
                                objGRNFinishProductDL.Add(obj);
                            }
                        }

                        objGRNDL.Approve(objGRN);
                        MessageBox.Show(this, "Suceessfully add to the Stock", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show(this, "There are no Items in the List, Please add Items before Continue", "Item List Empty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }