コード例 #1
0
        private void LoadPendingGRN()
        {
            string TrackingNo = Session["GRNID"].ToString();
            //TODO Warehouse from security manager.
            Guid          warehouseId = UserBLL.GetCurrentWarehouse();
            List <GRNBLL> list        = new List <GRNBLL>();
            GRNBLL        objGRN      = new GRNBLL();

            list = objGRN.GetPendingGRNByTrackingNo(warehouseId, TrackingNo);
            if (list != null)
            {
                if (list.Count == 1)
                {
                    this.cboGradingCode.Items.Add(new ListItem(list[0].GradingCode.ToString(), list[0].GradingId.ToString()));
                    this.cboGradingCode.SelectedValue = list[0].GradingId.ToString();
                }
                else if (list.Count == 1)
                {
                    this.lblmsg.Text = "An error has occred please contact the administrator.";
                    return;
                }
                else
                {
                    this.lblmsg.Text = "No Pending records";
                    return;
                }
            }
            else
            {
                this.lblmsg.Text = "No Pending records";
                return;
            }
        }
コード例 #2
0
        public bool CancelGRN(Guid GRNId, string TrackingNo, RequestforApprovedGRNCancelationStatus status)
        {
            bool   isSaved = false;
            GRNBLL objGRN  = new GRNBLL();

            objGRN = objGRN.GetbyGRN_Number(GRNId);
            GRNStatus GRNstatus = (GRNStatus)objGRN.Status;

            if (status == RequestforApprovedGRNCancelationStatus.Cancelled)
            {
                GRNstatus = GRNStatus.Cancelled;
            }
            if (objGRN != null)
            {
                if (GRNstatus == GRNStatus.Cancelled)
                {
                    isSaved = objGRN.Update(objGRN.GRN_Number, GRNstatus, objGRN, TrackingNo, DateTime.Now);
                }
                if (isSaved == true)
                {
                    ECXWF.CMessage mess = WFTransaction.Request(TrackingNo);
                    WFTransaction.WorkFlowManager(TrackingNo, mess);
                    isSaved = true;
                }
            }
            else
            {
                throw new Exception("Unable to find GRN");
            }
            return(isSaved);
        }
コード例 #3
0
        private void LoadQuantity()
        {
            float netWeight;
            int   NoBags;
            float qty;

            try
            {
                netWeight = float.Parse(this.lblNetWeight.Text);
            }
            catch
            {
                this.lblmsg.Text = "Net Weight is Invalid.";
                return;
            }
            Nullable <Guid> commodityGrade = null;

            if (DataValidationBLL.isGUID(this.hfCommodityGradeId.Value.ToString(), out commodityGrade) != true)
            {
                this.lblmsg.Text = "Commodity Grade in not availble please check and try again.";
                return;
            }
            if (int.TryParse(lblBags.Text, out NoBags) == false)
            {
                this.lblmsg.Text = "Invalid No Bags";
                return;
            }
            GRNBLL objQty = new GRNBLL();

            qty = GRNBLL.CalculateGRNQuantity(netWeight, NoBags, (Guid)commodityGrade);
            this.lblCurrentQuantity.Text  = qty.ToString();
            this.lblOriginalQuantity.Text = qty.ToString();
        }
コード例 #4
0
        private void LoadQuantity()
        {
            this.CommodityGradeID = new Guid(this.hfCommodityGradeId.Value.ToString());
            float netWeight;
            int   NoBags = -1;

            float qty;

            try
            {
                netWeight = float.Parse(this.lblNetWeight.Text);
            }
            catch
            {
                this.lblmsg.Text = "Net Weight is Invalid.";
                return;
            }
            if (int.TryParse(lblBags.Text, out NoBags) == false)
            {
                this.lblmsg.Text = "Number of Bags is Invalid.";
                return;
            }
            Guid commodityGrade = Guid.Empty;

            commodityGrade = new Guid(this.hfCommodityGradeId.Value.ToString());

            GRNBLL objQty = new GRNBLL();

            qty = GRNBLL.CalculateGRNQuantity(netWeight, NoBags, (Guid)commodityGrade);
            this.lblCurrentQuantity.Text  = qty.ToString();
            this.lblOriginalQuantity.Text = qty.ToString();
        }
コード例 #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            bool   isSaved = false;
            GRNBLL obj     = new GRNBLL();

            obj.Id                = new Guid(this.hfGRNID.Value.ToString());
            obj.ClientId          = new Guid(this.hfClientId.Value.ToString());
            obj.BagTypeId         = new Guid(this.hfBagTypeId.Value.ToString());
            obj.GRNTypeId         = new Guid(this.cboGRNType.SelectedValue.ToString());
            obj.DateDeposited     = DateTime.Parse(this.lblDateDeposited.Text);
            obj.TotalNumberOfBags = int.Parse(this.lblBags.Text);
            obj.GrossWeight       = float.Parse(this.lblGrossWeight.Text);
            obj.NetWeight         = float.Parse(this.lblNetWeight.Text);
            obj.OriginalQuantity  = float.Parse(this.lblOriginalQuantity.Text);
            obj.CurrentQuantity   = obj.OriginalQuantity;
            obj.TrackingNo        = ViewState["ReCreateGRNTrackingNo"].ToString();
            isSaved               = obj.ReCreateGRN();

            if (isSaved == true)
            {
                this.lblmsg.Text = "GRN Re-Created Successfully";
                return;
            }
            else
            {
                this.lblmsg.Text = "Unable to Re-create GRN";
                return;
            }
        }
コード例 #6
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            bool     isSaved = false;
            bool     ca      = false;
            DateTime cd;

            try
            {
                ca = Convert.ToBoolean(int.Parse(this.cboClientAccpted.SelectedValue.ToString()));
            }
            catch
            {
                this.lblmsg.Text = "please select client Response";
                this.cboClientAccpted.Focus();
                return;
            }
            cd = DateTime.Parse(this.txtClientAcceptedTimeStamp.Text);
            GRNBLL obj           = new GRNBLL();
            string TransactionNo = "";

            TransactionNo = Request.QueryString["TranNo"];
            GRNStatus prevStatus = (GRNStatus)(int.Parse(this.hfStatus.Value));

            isSaved = obj.ClientAcceptance(this.lblGRN.Text, cd, ca, TransactionNo, prevStatus);
            if (isSaved == true)
            {
                Response.Redirect("ListInbox.aspx");
            }
            else
            {
                this.lblmsg.Text = "Unable to process the request";
            }
        }
コード例 #7
0
        private void LoadGRNInformation(Guid GRN)
        {
            LoadGRNType();
            GRNBLL obj = new GRNBLL();

            obj = obj.GetbyGRN_Number(GRN);
            if (obj != null)
            {
                if (obj.GRN_Number != "")
                {
                    this.hfGRNID.Value            = obj.Id.ToString();
                    this.lblGRN.Text              = obj.GRN_Number;
                    this.lblTrackingNo.Text       = obj.TrackingNo;
                    this.lblProductionYear.Text   = obj.ProductionYear.ToString();
                    this.lblCode.Text             = obj.GradingCode;
                    this.lblDateDeposited.Text    = obj.DateDeposited.ToShortDateString();
                    this.lblBags.Text             = obj.TotalNumberOfBags.ToString();
                    this.lblGrossWeight.Text      = obj.GrossWeight.ToString();
                    this.lblNetWeight.Text        = obj.NetWeight.ToString();
                    this.lblOriginalQuantity.Text = obj.OriginalQuantity.ToString();
                    this.lblCurrentQuantity.Text  = obj.CurrentQuantity.ToString();
                    lblGRNCreatedDate.Text        = obj.GRNCreatedDate.ToShortDateString();
                    cmpSampGen.ValueToCompare     = obj.CreatedTimestamp.ToShortDateString();
                    this.lblCommodityGrade.Text   = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId);
                    ClientBLL objClient = new ClientBLL();
                    //objClient = ClientBLL.GetClinet(obj.ClientId);
                    //this.lblClinet.Text = objClient.ClientName;
                    LoadSampling(obj.GradingId);
                    LoadGrading(obj.GradingId);
                    LoadDepositeRequest(obj.CommodityRecivingId);
                    this.cboGRNType.SelectedValue = obj.GRNTypeId.ToString();
                    BagTypeBLL objBag = new BagTypeBLL();
                    objBag.GetBagTypeById(obj.BagTypeId);
                    this.lblBagType.Text         = objBag.BagTypeName;
                    this.cboStatus.SelectedValue = obj.Status.ToString();
                    if (obj.ClientAccepted == true)
                    {
                        this.cboClientAccpted.SelectedValue = "1";
                    }
                    else
                    {
                        this.cboClientAccpted.SelectedValue = "2";
                    }
                    this.txtClientAcceptedTimeStamp.Text = obj.ClientAcceptedTimeStamp.ToString();
                    this.hfStatus.Value = obj.Status.ToString();
                    if (this.cboStatus.SelectedValue == "4" && this.cboStatus.SelectedValue == "5" && this.cboStatus.SelectedValue == "6")
                    {
                        this.cboStatus.Enabled                  = false;
                        this.cboClientAccpted.Enabled           = false;
                        this.btnAdd.Enabled                     = false;
                        this.txtClientAcceptedTimeStamp.Enabled = false;
                        this.txtClientAcceptedTimeStamp.Visible = false;
                        this.cboClientAccpted.Visible           = false;
                        this.btnAdd.Visible                     = false;
                        this.lblmsg.Text = "The Client can not accpet or reject this GRN as the status of the GRN is not new or approved.";
                    }
                }
            }
        }
コード例 #8
0
        private void LoadData(Guid GRNId)
        {
            GRNBLL objGRN = new GRNBLL();

            objGRN = objGRN.GetbyGRN_Number(GRNId);
            if (objGRN != null)
            {
                this.txtGRNNo.Text = objGRN.GRN_Number.ToString();
            }
        }
コード例 #9
0
        public void UpdateReceipt()
        {
            string GRNNo    = txtGRNNo.Text;
            Guid   LICName2 = new Guid(ddLIC.SelectedValue.ToString());
            //Guid Shed = new Guid();
            string Shed               = DDLShed.SelectedItem.ToString();
            GRN_BL objGrnNew          = new GRN_BL();
            GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRNNo);
            WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);

            objWR.EditWHRtoWarehouse(GRNNo, Shed);
        }
コード例 #10
0
        protected void GRNApprovalEdit()
        {
            string dateEntered;
            string timeEntered;
            Guid   GRNNo;
            string GRN_No;
            int    response;

            Messages1.ClearMessage();
            int countError = 0;

            dateEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtDateTimeLICSigned")).Text;
            timeEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtTimeLICSigned")).Text;
            GRNNo       = new Guid(grvGRNApproval.DataKeys[0].Value.ToString());
            GRN_No      = ((Label)grvGRNApproval.Rows[0].FindControl("lblGRNNo")).Text;
            response    = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue);

            if (dateEntered == "" || timeEntered == "")
            {
                Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning);
                countError++;
            }

            if (countError == 0)
            {
                try
                {
                    GRNApprovalModel.UpdateGRNSupervisorApproval(GRNNo, UserBLL.CurrentUser.UserId, response, (DateTime.Parse(dateEntered + " " + timeEntered)), DateTime.Now);

                    // if Superevisor Accept it create WarehouseReciept....
                    if (response == 1)
                    {
                        GRN_BL objGrnNew          = new GRN_BL();
                        GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);
                        WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                        objWR.Save();
                    }

                    BindGRNApprovalGridviewForEdit();
                    Messages1.SetMessage("Updated successfully.", Messages.MessageType.Success);
                }
                catch (Exception ex)
                {
                    Messages1.SetMessage(ex.Message, Messages.MessageType.Error);
                }
            }
            else
            {
                btnApprove.Style["visibility"] = "visible";
            }
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.DataBind();
            if (IsPostBack != true)
            {
                Nullable <Guid> GRN_number = null;

                if (Session["GRNID"] != null)
                {
                    try
                    {
                        //Get Commodity deposite Request Id  from the GRN;
                        GRN_number = new Guid(Session["GRNID"].ToString());
                        if (Session["GRNTrackingNo"] != null)
                        {
                            this.lblCurrentTrackingNo.Text = Session["GRNTrackingNo"].ToString();
                        }
                        else
                        {
                            GRNBLL objGRN = new GRNBLL();
                            objGRN = objGRN.GetbyGRN_Number((Guid)GRN_number);
                            if (objGRN != null)
                            {
                                GradingBLL objGrading = new GradingBLL();
                                objGrading = objGrading.GetById(objGRN.GradingId);
                                this.lblCurrentTrackingNo.Text = objGrading.TrackingNo;
                            }
                        }
                        LoadGRNInformation((Guid)GRN_number);
                        LoadStatus();
                        Session["GRNID"]         = null;
                        Session["GRNTrackingNo"] = null;
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                    LoadServices();
                }

                this.btnAdd.Attributes.Add("btnGRNService_Click", "ValidateGRNService");
                if (Session["msg"] != null)
                {
                    ECXWF.CMessage mess = (ECXWF.CMessage)Session["msg"];
                    if (mess.Name == "EditGRN")
                    {
                        this.pnl.Visible = false;
                    }
                }
            }
        }
コード例 #12
0
        private void LoadGRNInformation(Guid GRNId)
        {
            LoadGRNType();
            GRNBLL obj = new GRNBLL();

            obj = obj.GetbyGRN_Number(GRNId);
            if (obj != null)
            {
                if (obj.GRN_Number != "")
                {
                    this.hfGRNId.Value      = obj.Id.ToString();
                    this.lblGRN.Text        = obj.GRN_Number;
                    this.lblTrackingNo.Text = obj.TrackingNo;
                    //this.lblProductionYear.Text = obj.ProductionYear.ToString();
                    this.lblCode.Text             = obj.GradingCode;
                    this.lblDateDeposited.Text    = obj.DateDeposited.ToShortDateString();
                    this.lblBags.Text             = obj.TotalNumberOfBags.ToString();
                    this.lblGrossWeight.Text      = obj.GrossWeight.ToString();
                    this.lblNetWeight.Text        = obj.NetWeight.ToString();
                    this.lblOriginalQuantity.Text = obj.OriginalQuantity.ToString();
                    this.lblCurrentQuantity.Text  = obj.CurrentQuantity.ToString();
                    this.lblCommodityGrade.Text   = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId);
                    ClientBLL objClient = new ClientBLL();
                    LoadSampling(obj.GradingId);
                    LoadGrading(obj.GradingId);
                    LoadDepositeRequest(obj.CommodityRecivingId);
                    GetGRNServices(GRNId);
                    this.cboGRNType.SelectedValue = obj.GRNTypeId.ToString();
                    BagTypeBLL objBag = new BagTypeBLL();
                    objBag.GetBagTypeById(obj.BagTypeId);
                    this.lblBagType.Text = objBag.BagTypeName;
                    this.hfStatus.Value  = obj.Status.ToString();
                    if (obj.ClientAcceptedTimeStamp != null)
                    {
                        this.txtClientAcceptedTimeStamp.Text = obj.ClientAcceptedTimeStamp.ToShortDateString();
                    }
                    this.chkClientAccepted.Checked = obj.ClientAccepted;
                    if (this.chkClientAccepted.Checked != true)
                    {
                        //TOdo- GRN Statas.
                    }
                    if (this.cboStatus.SelectedValue == "6" || this.cboStatus.SelectedValue == "3")
                    {
                        this.cboStatus.Enabled = false;
                        this.btnAdd.Enabled    = false;
                    }
                }
            }
        }
コード例 #13
0
        private void LoadNetWeight()
        {
            if (this.CommodityGradeID == Guid.Empty)
            {
                this.lblmsg.Text = "Invalid Commodity Grade";
                return;
            }
            float grossweight;

            try
            {
                grossweight = float.Parse(this.lblGrossWeight.Text);
            }
            catch
            {
                this.lblmsg.Text = "Gross weight in not availble please check and try again.";
                return;
            }

            Nullable <Guid> BagId = null;

            if (DataValidationBLL.isGUID(this.hfBagTypeId.Value.ToString(), out BagId) != true)
            {
                this.lblmsg.Text = "Bag type in not availble please check and try again.";
                return;
            }
            Nullable <int> NoBags = null;

            if (DataValidationBLL.isInteger(this.lblBags.Text, out NoBags) != true)
            {
                this.lblmsg.Text = "Number of bags in not availble please check and try again.";
                return;
            }

            float  netWeight;
            GRNBLL objNetWeight = new GRNBLL();

            try
            {
                netWeight = (float)objNetWeight.CalculateNetWeight((float)grossweight, (Guid)BagId, (int)NoBags, this.CommodityGradeID);
                this.lblNetWeight.Text = netWeight.ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #14
0
        private void BindData(Guid Id)
        {
            ScalingBLL obj = new ScalingBLL();

            obj = obj.GetById(Id);
            if (obj != null)
            {
                if (obj.Id != null)
                {
                    this.hfId.Value = obj.Id.ToString();
                }
                if (obj.ScaleTicketNumber != "")
                {
                    this.txtScaleTicket.Text = obj.ScaleTicketNumber.ToString();
                }
                if (obj.DateWeighed != null)
                {
                    this.txtDateWeighed.Text = obj.DateWeighed.ToString();
                }
                this.cboWeigher.SelectedValue = obj.WeigherId.ToString();
                this.txtGrossTruckWeight.Text = obj.GrossWeightWithTruck.ToString();

                this.txtGrossWeoght.Text = obj.GrossWeight.ToString();
                this.txtTruckWeight.Text = obj.TruckWeight.ToString();

                this.txtRemark.Text          = obj.Remark;
                this.cboStatus.SelectedValue = ((int)obj.Status).ToString();
                DriverInformationBLL objDriver = new DriverInformationBLL();
                if (obj.DriverInformationId != null)
                {
                    objDriver = objDriver.GetById(obj.DriverInformationId);
                    if (objDriver != null)
                    {
                        this.lblPlateNo.Text   = objDriver.PlateNumber;
                        this.lblTrailerNo.Text = objDriver.TrailerPlateNumber;
                    }
                }
                bool   hasGRN = false;
                GRNBLL objGRN = new GRNBLL();
                hasGRN = objGRN.HasGRN("tblScaling", obj.Id);
                if (hasGRN == true)
                {
                    this.btnAdd.Enabled  = false;
                    this.lblMessage.Text = "You can't update this Data because a GRN has already been Created for it.";
                }
            }
        }
コード例 #15
0
        private void detail_Format(object sender, EventArgs e)
        {
            //if (HttpContext.Current.Session["BrID"] == null)
            //{
            //    throw new Exception("Your Session has expired");
            //}
            //else
            //{
            //    Guid ID = new Guid(HttpContext.Current.Session["BrID"].ToString());

            GRNBLL    gr = new GRNBLL();
            DataTable r  = gr.GetGRNList();

            if (r != null)
            {
                //rptGRN.s
            }
            //}
        }
コード例 #16
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.cboStatus.SelectedValue == "6")// need to consume the webservice.
            {
                bool   isSaved = false;
                GRNBLL objGRN  = new GRNBLL();
                objGRN = objGRN.GetbyGRN_Number(new Guid(this.hfGRNId.Value.ToString()));
                objGRN.ApprovedTimeStamp = DateTime.Now;
                objGRN.TrackingNo        = this.lblCurrentTrackingNo.Text;

                objGRN.ManagerApprovedDateTime = DateTime.Parse(this.txtMADate.Text + " " + this.txtTime.Text);


                isSaved = objGRN.Update(this.lblGRN.Text, (GRNStatus)int.Parse(this.cboStatus.SelectedValue), objGRN, objGRN.TrackingNo, objGRN.ManagerApprovedDateTime);
                if (isSaved == true)
                {
                    this.lblmsg.Text = "GRN Updated Successfully";
                    LoadGRNInformation(new Guid(this.hfGRNId.Value.ToString()));
                    Response.Redirect("ListInbox.aspx");
                }
                else
                {
                    this.lblmsg.Text = "Can not update the GRN.";
                }
            }
            else if (this.cboStatus.SelectedValue == "3")
            {
                GRNBLL objGRN = new GRNBLL();
                objGRN = objGRN.GetbyGRN_Number(new Guid(this.hfGRNId.Value.ToString()));

                bool isSaved = objGRN.Update(objGRN.GRN_Number, GRNStatus.Cancelled, objGRN, objGRN.TrackingNo, objGRN.ManagerApprovedDateTime);
                if (isSaved == false)
                {
                    this.lblmsg.Text = "Can not update the GRN.";
                    return;
                }
                else
                {
                    this.lblmsg.Text = "GRN Cancelled.";
                }
            }
        }
コード例 #17
0
        private void LoadData(Guid GRNID)
        {
            // load GRN Data
            GRNBLL objGRN = new GRNBLL();

            objGRN = objGRN.GetbyGRN_Number(GRNID);
            if (objGRN != null)
            {
                if (objGRN.Id != null)
                {
                    this.hfGRNID.Value = objGRN.Id.ToString();
                }
                else
                {
                    throw new Exception("Unable to Load GRN Related Data.");
                }
                if (objGRN.CommodityRecivingId != null)
                {
                    hfReceivigRequestId.Value = objGRN.CommodityRecivingId.ToString();
                    //Load Commodity Deposite Information.
                    LoadDepositeRequest(objGRN.CommodityRecivingId);
                }
                if (objGRN.TrackingNo != "")
                {
                    hfTrackingNo.Value      = objGRN.TrackingNo;
                    this.lblTrackingNo.Text = objGRN.TrackingNo;
                }
                if (objGRN.VoucherId != null)
                {
                    hfVoucherId.Value = objGRN.VoucherId.ToString();
                }
                this.lblGRN_Number.Text = objGRN.GRN_Number;
                LoadSampling(objGRN.GradingId);
                LoadGrading(objGRN.GradingId);
                LoadUnloading(objGRN.GradingId);
                ScalingInformation(objGRN.GradingId);
                LoadNetWeight();
                LoadQuantity();
                LoadVoucherInformation(objGRN.CommodityRecivingId);
            }
        }
コード例 #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["GRNIDUpdateGRNNo"] != null)
     {
         if (Session["TrackingNoUpdateGRNNo"] != null)
         {
             ViewState["TrackingNo"] = Session["TrackingNoUpdateGRNNo"].ToString();
         }
         else
         {
             ViewState["TrackingNo"] = -1;
         }
         Session["TrackingNoUpdateGRNNo"] = null;
         Guid Id = new Guid(Session["GRNIDUpdateGRNNo"].ToString());
         Session["GRNIDUpdateGRNNo"] = null;
         GRNBLL objGRN = new GRNBLL();
         objGRN = objGRN.GetbyGRN_Number(Id);
         this.lblNewGRN.Text = objGRN.GRN_Number;
         ViewState["GRNId"]  = objGRN.Id.ToString();
     }
 }
コード例 #19
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ViewState["GRNId"] != null)
     {
         GRNBLL obj     = new GRNBLL();
         bool   isSaved = false;
         isSaved = obj.UpdateGRNNumber(new Guid(ViewState["GRNId"].ToString()),
                                       this.txtOldSystemGRNNo.Text, lblNewGRN.Text, ViewState["TrackingNo"].ToString());
         if (isSaved == true)
         {
             this.lblMessage.Text   = "Update Data Successfully.";
             this.btnUpdate.Enabled = false;
             return;
         }
         this.btnUpdate.Enabled = false;
     }
     else
     {
         this.lblMessage.Text = "Unable to update Data.Please try again";
         return;
     }
 }
コード例 #20
0
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            bool   isSaved    = false;
            GRNBLL objGRN     = new GRNBLL();
            string TrackingNo = "";

            TrackingNo        = this.hfTrackingNo.Value;
            objGRN.GRN_Number = this.UIEditGRN1.lblGRN.Text;
            objGRN.Id         = new Guid(this.UIEditGRN1.hfGRNId.Value.ToString());
            objGRN.GradingId  = new Guid(this.UIEditGRN1.hfGradingId.Value.ToString());
            isSaved           = objGRN.Update(this.UIEditGRN1.lblGRN.Text, GRNStatus.Cancelled, objGRN, TrackingNo, DateTime.Now);
            if (isSaved == true)
            {
                this.UIEditGRN1.lblmsg.Text = "Update Sucessfull";
                this.btnCancel.Enabled      = false;
                return;
            }
            else
            {
                this.UIEditGRN1.lblmsg.Text = "Unable to cancel the GRN.";
                return;
            }
        }
コード例 #21
0
        private void rptGRN_ReportStart(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["GRNIDPrint"] == null)
            {
                throw new Exception("Session expired");
            }
            Guid GRNId = Guid.Empty;

            GRNId = new Guid(HttpContext.Current.Session["GRNIDPrint"].ToString());
            Guid   GradingId = Guid.Empty;
            GRNBLL objGRN    = new GRNBLL();

            objGRN              = objGRN.GetbyGRN_Number(GRNId);
            GradingId           = objGRN.GradingId;
            this.lblGRN_No.Text = objGRN.GRN_Number;
            this.lblClient.Text = ClientBLL.GetClinetNameById(objGRN.ClientId);

            this.lblCommodityGrade.Text   = CommodityGradeBLL.GetCommodityGradeNameById(objGRN.CommodityGradeId);
            this.lblWarehouse.Text        = WarehouseBLL.GetWarehouseNameById(objGRN.WarehouseId);
            this.lblOriginalQuantity.Text = objGRN.OriginalQuantity.ToString();
            this.lblNetWeight.Text        = objGRN.NetWeight.ToString();
            this.lblDateDeposited.Text    = objGRN.DateDeposited.ToShortDateString();
            this.lblTimeDeposited.Text    = objGRN.DateDeposited.ToShortTimeString();
            this.lblNoBags.Text           = objGRN.TotalNumberOfBags.ToString();
            //Bag Type
            BagTypeBLL objBt = new BagTypeBLL();

            objBt.GetBagTypeById(objGRN.BagTypeId);
            lblBagType.Text = objBt.BagTypeName;

            //Driver Information

            List <DriverInformationBLL> list  = null;
            DriverInformationBLL        objDI = new DriverInformationBLL();

            list = objDI.GetActiveDriverInformationByReceivigRequestId(objGRN.CommodityRecivingId);
            if (list != null)
            {
                string driverName          = "";
                string plateNo             = "";
                string driverLicense       = "";
                string licensceIssuedPlace = "";
                foreach (DriverInformationBLL o in list)
                {
                    if (driverName == "")
                    {
                        driverName = o.DriverName;
                    }
                    else
                    {
                        driverName += "," + o.DriverName;
                    }
                    if (plateNo == "")
                    {
                        if (String.IsNullOrEmpty(o.TrailerPlateNumber) != true)
                        {
                            plateNo = o.PlateNumber + "-" + o.TrailerPlateNumber;
                        }
                        else
                        {
                            plateNo = o.PlateNumber;
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(o.TrailerPlateNumber) != true)
                        {
                            plateNo += " , " + o.PlateNumber + "-" + o.TrailerPlateNumber;
                        }
                        else
                        {
                            plateNo += " , " + o.PlateNumber;
                        }
                    }
                    if (driverLicense == "")
                    {
                        driverLicense = o.LicenseNumber;
                    }
                    else
                    {
                        driverLicense += " , " + o.LicenseNumber;
                    }
                    if (licensceIssuedPlace == "")
                    {
                        licensceIssuedPlace = o.LicenseIssuedPlace;
                    }
                    else
                    {
                        licensceIssuedPlace += " , " + o.LicenseIssuedPlace;
                    }
                }
                this.lblDriverName.Text    = driverName;
                this.lblPlateNo.Text       = plateNo;
                this.lblDriverLicense.Text = driverLicense;
                this.lblPlaceIssued.Text   = licensceIssuedPlace;
            }
            // Scaling
            ScalingBLL objScaling = new ScalingBLL();

            objScaling = objScaling.GetById(objGRN.ScalingId);
            if (objScaling != null)
            {
                if (objScaling.WeigherId != null)
                {
                    try
                    {
                        this.lblWeigherName.Text = UserRightBLL.GetUserNameByUserId(objScaling.WeigherId);
                    }
                    catch
                    {
                    }
                }
            }
            // Sampler
            SamplerBLL objSampler = new SamplerBLL();

            objSampler = objSampler.GetActiveSamplingSupBySamplingId(objGRN.SamplingTicketId);
            if (objSampler != null)
            {
                this.lblSampler.Text = UserRightBLL.GetUserNameByUserId(objSampler.SamplerId);
            }
            //Graders
            GradingByBLL objGrader = new GradingByBLL();

            this.lblGrader.Text = objGrader.GetSupGraderNameByGradingId(objGRN.GradingId);

            if (objGRN.ApprovedBy != null)
            {
                try
                {
                    this.lblApprovedBy.Text = UserRightBLL.GetUserNameByUserId(objGRN.ApprovedBy);
                }
                catch
                {
                }
            }
            if (objGRN.ApprovedTimeStamp != null)
            {
                this.lblDateAproved.Text = objGRN.ApprovedTimeStamp.ToShortDateString();
            }
            rpt   = new rptGrading(GradingId);
            rptGS = new rptGRNService(GRNId);
            this.txtDateGenerated.Text = DateTime.Now.ToString();
            ScalingBLL objSacling = new ScalingBLL();

            objSacling = objSacling.GetById(objGRN.ScalingId);
            if (objSacling != null)
            {
                this.lblScaleTicketNo.Text = objSacling.ScaleTicketNumber;
            }

            this.subReport1.Report = rpt;
            this.subReport2.Report = this.rptGS;
        }
コード例 #22
0
        private void BindUnloading()
        {
            try
            {
                Guid UnloadingId = new Guid(Request.QueryString["Id"].ToString());
                this.hfUnloadingId.Value = UnloadingId.ToString();
                UnloadingBLL      obj = new UnloadingBLL();
                CommodityGradeBLL objCommodityGrade = new CommodityGradeBLL();
                obj.Id = UnloadingId;
                obj    = obj.GetById();

                if (obj != null)
                {
                    this.lblGradingCode.Text = obj.GradingCode.ToString();
                    string CommodityGradeName = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId);
                    this.lblCommodityGrade.Text       = CommodityGradeName;
                    this.txtNumberOfBags.Text         = obj.TotalNumberOfBags.ToString();
                    this.txtDateDeposited.Text        = obj.DateDeposited.ToShortDateString();
                    this.cboStatus.SelectedValue      = ((int)obj.Status).ToString();
                    ViewState["UnloadingCommGradeId"] = obj.CommodityGradeId;
                    ViewState["totBagCount"]          = obj.TotalNumberOfBags.ToString();
                    // Get Grading Id
                    GradingResultBLL objGradingResult = new GradingResultBLL();
                    objGradingResult = objGradingResult.GetGradingResultById(obj.GradingResultId);
                    if (objGradingResult != null)
                    {
                        GradingBLL objGrading = new GradingBLL();
                        objGrading = objGrading.GetById(objGradingResult.GradingId);
                        if (objGrading != null)
                        {
                            SamplingResultBLL objSamplingResult = new SamplingResultBLL();
                            objSamplingResult = objSamplingResult.GetSamplingResultById(objGrading.SamplingResultId);
                            if (objSamplingResult != null)
                            {
                                ViewState["SamplingNoBags"] = objSamplingResult.NumberOfBags;
                            }
                            else
                            {
                                this.lblmsg.Text = "An error has occured please try again.If the error persists contact the administrator";
                                return;
                            }
                        }
                        else
                        {
                            this.lblmsg.Text = "An error has occured please try agin.If the error persists contact the administrator";
                            return;
                        }
                    }
                }

                //TODO :Remove the ff

                // this.cboStackNo.Items.Add(new ListItem("Stack No 1", "eaf7ebcc-f39a-4c7d-b855-1e5d5578dbcb"));

                //TODO Remove Comment

                Guid warehouseId = UserBLL.GetCurrentWarehouse();
                // Loading shedby warehouse.
                ShedBLL        shed     = new ShedBLL();
                List <ShedBLL> shedlist = new List <ShedBLL>();
                shedlist = shed.GetActiveShedByWarehouseId(warehouseId);
                cboShed.Items.Add(new ListItem("Please select Shed", ""));
                if (shedlist.Count > 0)
                {
                    foreach (ShedBLL o in shedlist)
                    {
                        cboShed.Items.Add(new ListItem(o.ShedNumber, o.Id.ToString()));
                    }
                }
                else
                {
                    this.btnAdd.Enabled = false;
                }

                GRNBLL objGRN = new GRNBLL();
                string strE   = " UnLoadingId='" + UnloadingId.ToString() + "' ";
                if (objGRN.IsEditableGRN(strE) == false)
                {
                    this.btnAdd.Enabled  = false;
                    this.btnSave.Enabled = false;
                    this.lblmsg.Text     = "You can't edit this information as GRN has already been created using this Unloading Information.";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #23
0
        protected void gvGRN_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            // Label id = (Label)row.FindControl("lblGRN");
            int index = Convert.ToInt32(e.CommandArgument);

            GridViewRow rw = this.gvGRN.Rows[index];

            if (e.CommandName == "View")
            {
                if (rw != null)
                {
                    Label id = (Label)rw.FindControl("lblId");
                    if (id != null)
                    {
                        Session["GRNID"] = id.Text;
                        Response.Redirect("ViewGRN.aspx");
                    }
                }
            }
            //Update GRN No
            if (e.CommandName == "cmdGRNNoUpdate")
            {
                Label id = (Label)rw.FindControl("lblId");
                if (id != null)
                {
                    //Session["GRNIDUpdateGRNNo"] = id.Text;
                    //Response.Redirect("UpdateGRNNumber.aspx");
                }
            }
            else if (e.CommandName == "cmdPrint")
            {
                if (rw != null)
                {
                    Label id = (Label)rw.FindControl("lblId");
                    if (id != null)
                    {
                        Session["GRNIDPrint"] = id.Text;
                        StringBuilder sb = new StringBuilder();
                        sb.Append("<script>");
                        sb.Append("window.open('rptGRN.aspx");
                        sb.Append("', '', 'toolbar=0');");
                        sb.Append("</scri");
                        sb.Append("pt>");
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ShowReport",
                                                                sb.ToString(), false);
                    }
                }
            }
            else if (e.CommandName == "Edit")
            {
                if (rw != null)
                {
                    Label id        = (Label)rw.FindControl("lblId");
                    Label lblStatus = (Label)rw.FindControl("lblStatus");
                    if (lblStatus != null)
                    {
                        if (lblStatus.Text.ToUpper() != "NEW" && lblStatus.Text.ToUpper() != "OpenForEdit".ToUpper())
                        {
                            Session["GRNIDRequestCD"] = id.Text;
                            Response.Redirect("AddApprovedGRNEditRequest.aspx");
                        }
                        else if (lblStatus.Text.ToUpper() == "OpenForEdit".ToUpper())
                        {
                            Session["ReCreateGRNID"] = id.Text;
                            Response.Redirect("ReCreateGRN.aspx");
                        }
                        else if (lblStatus.Text.ToUpper() == "NEW")
                        {
                            Session["ReCreateGRNID"] = id.Text;
                            GRNBLL objGRN = new GRNBLL();
                            objGRN = objGRN.GetbyGRN_Number(new Guid(id.Text));
                            Session["ReCreateGRNTrackingNo"] = objGRN.TrackingNo;
                            Response.Redirect("ReCreateGRN.aspx");
                        }
                        else
                        {
                            Session["GRNID"] = id.Text;
                            Response.Redirect("ViewGRN.aspx");
                        }
                    }
                }
            }
            else if (e.CommandName == "cmdCancel")
            {
                if (rw != null)
                {
                    Label id        = (Label)rw.FindControl("lblId");
                    Label lblStatus = (Label)rw.FindControl("lblStatus");
                    if (lblStatus != null)
                    {
                        if (lblStatus.Text.ToUpper() == "NEW" || lblStatus.Text.ToUpper() == "ClientAccepted".ToUpper() || lblStatus.Text.ToUpper() == "ClientRejected".ToUpper())
                        {
                            Session["GRNID"] = id.Text;
                            Response.Redirect("ViewGRN.aspx");
                        }
                        else if (lblStatus.Text.ToUpper() == "ManagerApproved".ToUpper())
                        {
                            Session["ApprovedGRNCancelationID"] = id.Text;
                            Response.Redirect("RequestApprovedGRNCancelation.aspx");
                        }
                    }
                }
            }
        }
コード例 #24
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            List <GRNServiceBLL> listGRNService = null;

            if (ViewState["listGRNService"] != null)
            {
                listGRNService = (List <GRNServiceBLL>)ViewState["listGRNService"];
            }
            Nullable <Guid> id     = null;
            GRNBLL          objGRN = new GRNBLL();

            objGRN.CommodityGradeId    = new Guid(this.hfCommodityGradeId.Value.ToString());
            objGRN.CommodityRecivingId = new Guid(this.hfReceivigRequestId.Value.ToString());
            objGRN.WarehouseId         = new Guid(this.hfWarehouseId.Value.ToString());
            objGRN.BagTypeId           = new Guid(this.hfBagTypeId.Value.ToString());
            try
            {
                objGRN.VoucherId = new Guid(this.hfVoucherId.Value.ToString());
            }
            catch
            {
                //TODO : check if Coffee / commodity with Voucher - then retun.
            }
            objGRN.UnLoadingId = new Guid(this.hfUnloadingId.Value.ToString());

            objGRN.ScalingId         = new Guid();
            objGRN.GradingId         = new Guid(this.hfGradingId.Value.ToString());
            objGRN.SamplingTicketId  = new Guid(this.hfSamplingId.Value.ToString());
            objGRN.GRNTypeId         = new Guid(this.cboGRNType.SelectedValue.ToString());
            objGRN.DateDeposited     = Convert.ToDateTime(this.lblDateDeposited.Text);
            objGRN.Status            = (int)GRNStatus.New;
            objGRN.TotalNumberOfBags = Convert.ToInt32(this.lblBags.Text);
            objGRN.GradingCode       = this.cboGradingCode.SelectedItem.ToString();
            objGRN.GRNCreatedDate    = DateTime.Parse(this.txtDateRecived.Text);
            try
            {
                objGRN.ClientId = new Guid(this.hfClientId.Value.ToString());
            }
            catch
            {
                this.lblmsg.Text = "Invalid Client Id please check and try again.";
                return;
            }

            try
            {
                objGRN.GrossWeight = float.Parse(this.lblGrossWeight.Text);
                objGRN.NetWeight   = float.Parse(this.lblNetWeight.Text);
            }
            catch
            {
                this.lblmsg.Text = " Weight Can not be calculated please check and try again.";
                return;
            }
            try
            {
                objGRN.OriginalQuantity = float.Parse(this.lblOriginalQuantity.Text);
                objGRN.CurrentQuantity  = float.Parse(this.lblCurrentQuantity.Text);
            }
            catch
            {
                this.lblmsg.Text = "Quantity Can not be calculated please check and try again.";
                return;
            }
            if (string.IsNullOrEmpty(this.hfTrackingNo.Value.ToString()) == true)
            {
                this.lblmsg.Text = "Can not load Tracking No.";
                return;
            }
            else
            {
                objGRN.TrackingNo = this.hfTrackingNo.Value;
            }
            if (bool.Parse(ViewState["hasVoucher"].ToString()) == true)
            {
                if (string.IsNullOrEmpty(this.hfVoucherId.Value.ToString()) == true)
                {
                    this.lblmsg.Text = "Can not load Voucher information.";
                    return;
                }
                else
                {
                    try
                    {
                        objGRN.VoucherId = new Guid(this.hfVoucherId.Value);
                    }
                    catch
                    {
                        this.lblmsg.Text = "Can not load Voucher information.";
                        return;
                    }
                }
            }
            else
            {
                objGRN.VoucherId = Guid.Empty;
            }
            if (string.IsNullOrEmpty(this.hfScalingId.Value.ToString()) == true)
            {
                this.lblmsg.Text = "Can not load Scaling information.";
                return;
            }
            else
            {
                try
                {
                    objGRN.ScalingId = new Guid(this.hfScalingId.Value);
                }
                catch
                {
                    this.lblmsg.Text = "Can not load Voucher information.";
                    return;
                }
            }
            try
            {
                id = objGRN.Add(listGRNService);
                Session["GRNIDPrint"] = id.ToString();
            }
            catch (IndeterminateGRNCountException)
            {
                this.lblmsg.Text = "Please check if GRN is Created and try again.";
                return;
            }
            catch (MultipleGRNForSingleGradingCodeException)
            {
                this.lblmsg.Text = "A GRN has already been created for this Grading Code.";
                return;
            }
            catch (Exception ex)
            {
                //this.lblmsg.Text = "An error has occured please try again.If the error persists contact the administrator.";
                //return;
                throw ex;
            }

            if (id != null)
            {
                Session["GRNID"] = id.ToString();
                this.lblmsg.Text = "New GRN added Successfully.";
                //Response.Redirect("PageSwicther.aspx?TranNo=" + objGRN.TrackingNo);

                ScriptManager.RegisterStartupScript(this,
                                                    this.GetType(),
                                                    "ShowReport",
                                                    "<script type=\"text/javascript\">" +
                                                    string.Format("javascript:window.open(\"rptGRN.aspx?id={0}\", \"_blank\",\"height=400px,width=600px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +
                                                    "</script>",
                                                    false);
            }
            else
            {
                this.lblmsg.Text = "Unable to add new GRN please try Again";
                return;
            }
            //if (id != null)
            //{



            //}
        }
コード例 #25
0
        protected void grvGRNApproval_SelectedIndexChanged(object sender, EventArgs e)
        {
            Guid     ID, StackID;
            DateTime LICApprovedDate;
            string   dateEntered, timeEntered, GRN_No, message;
            int      response;

            ID              = new Guid(grvGRNApproval.SelectedDataKey.Value.ToString());
            StackID         = new Guid(((Label)grvGRNApproval.SelectedRow.FindControl("lblStackID")).Text);
            dateEntered     = ((TextBox)grvGRNApproval.SelectedRow.FindControl("txtDateTimeLICSigned")).Text;
            timeEntered     = ((TextBox)grvGRNApproval.SelectedRow.FindControl("txtTimeLICSigned")).Text;
            GRN_No          = ((Label)grvGRNApproval.SelectedRow.FindControl("lblGRNNo")).Text;
            response        = int.Parse(((DropDownList)grvGRNApproval.SelectedRow.FindControl("drpLICStatus")).SelectedValue);
            LICApprovedDate = DateTime.Parse(((Label)grvGRNApproval.SelectedRow.FindControl("lblGRNCreatedDate")).Text);

            if (isValidDateTime(dateEntered, timeEntered, LICApprovedDate))
            {
                try
                {
                    if (((bool)ViewState["edit"]))
                    {
                        GRNApprovalModel.UpdateGRNSupervisorApproval(ID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now);
                        BindGRNApprovalGridviewForEdit();
                        message = "Updated successfully.";
                    }
                    else
                    {
                        if (response == 1) //if Superevisor Accept it create WarehouseReciept....
                        {
                            GRN_BL objGrnNew = new GRN_BL();
                            GRNBLL objGrnOld = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);

                            // Create the TransactionScope to execute the commands
                            TransactionOptions option = new TransactionOptions();
                            option.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
                            option.Timeout        = new TimeSpan(0, 0, 60);

                            using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, option))
                            {
                                GRNApprovalModel.ApproveGRNBySupervisor(ID, StackID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now);
                                BindGRNApprovalGridview();

                                //create WarehouseReciept
                                WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                                objWR.Save2();

                                // The Complete method commits the transaction
                                transaction.Complete();
                            }
                        }

                        else
                        {
                            GRNApprovalModel.ApproveGRNBySupervisor(ID, StackID, UserBLL.CurrentUser.UserId, response, DateTime.Parse(dateEntered + " " + timeEntered), DateTime.Now);
                            BindGRNApprovalGridview();
                        }

                        message = "Approved successfully";
                        Messages1.SetMessage(message, Messages.MessageType.Success);
                    }
                }

                catch (Exception ex)
                {
                    Messages1.SetMessage("Unable to save record. Please try again.", WarehouseApplication.Messages.MessageType.Error);
                }
            }
        }
コード例 #26
0
        protected void GRNApprovalBySupervisor()
        {
            string dateEntered;
            string timeEntered;
            string GRNNo;
            string GRN_No;
            int    response;

            Messages1.ClearMessage();
            int countError = 0;

            string GRNApprovalXML = "<GRNApproval>";

            foreach (GridViewRow gvr in this.grvGRNApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    // check if date and time is not empty
                    dateEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text;
                    timeEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text;
                    GRNNo       = grvGRNApproval.DataKeys[gvr.RowIndex].Value.ToString();
                    GRN_No      = ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblGRNNo")).Text;
                    response    = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue);

                    // if Superevisor Accept it create WarehouseReciept....
                    if (response == 1)
                    {
                        GRN_BL objGrnNew          = new GRN_BL();
                        GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);
                        WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                        objWR.Save();
                    }

                    if (dateEntered == "" || timeEntered == "")
                    {
                        Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning);
                        countError++;
                    }
                    if (countError == 0)
                    {
                        GRNApprovalXML +=
                            "<GRNApprovalItem> <ID>" + GRNNo + "</ID>" +
                            "<WarehouseSupervisorApprovedBy>" + UserBLL.CurrentUser.UserId + "</WarehouseSupervisorApprovedBy>" +
                            "<WarehouseSupervisorApprovedDateTime>" + dateEntered + " " + timeEntered + "</WarehouseSupervisorApprovedDateTime>" +
                            "<WarehouseSupervisorApprovedTimeStamp>" + DateTime.Now + "</WarehouseSupervisorApprovedTimeStamp>" +
                            "<WarehouseSupervisorStatus>" + response + "</WarehouseSupervisorStatus>" +
                            "<Status>" + 3 + "</Status>" +
                            "<StackID>" + ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblStackID")).Text + "</StackID>" +
                            "</GRNApprovalItem>";
                    }
                }
            }
            if (countError == 0)
            {
                try
                {
                    GRNApprovalXML += "</GRNApproval>";
                    GRNApprovalModel.ApproveGRNBySupervisor(GRNApprovalXML);
                    BindGRNApprovalGridview();
                    Messages1.SetMessage("Approved successfully.", Messages.MessageType.Success);
                    BindLIC(status);
                }
                catch (Exception ex)
                {
                    Messages1.SetMessage(ex.Message, Messages.MessageType.Error);
                }
            }
            else
            {
                btnApprove.Style["visibility"] = "visible";
            }
        }