示例#1
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);
        }
示例#2
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.";
                    }
                }
            }
        }
示例#3
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();
            }
        }
示例#4
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;
                    }
                }
            }
        }
示例#5
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;
                    }
                }
            }
        }
示例#6
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.";
                }
            }
        }
示例#7
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);
            }
        }
示例#8
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();
     }
 }
示例#9
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;
        }
示例#10
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");
                        }
                    }
                }
            }
        }