Exemple #1
0
        private void LoadDepositeRequest(Guid commDepositeId)
        {
            CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();

            objCDR = objCDR.GetCommodityDepositeDetailById(commDepositeId);
            if (objCDR != null)
            {
                this.lblProductionYear.Text    = objCDR.ProductionYear.ToString();
                this.lblDateRecived.Text       = objCDR.DateTimeRecived.ToString();
                this.lblTrackingNo.Text        = objCDR.TrackingNo;
                this.hfReceivigRequestId.Value = commDepositeId.ToString();
                this.hfWarehouseId.Value       = objCDR.WarehouseId.ToString();
                LoadClient(objCDR.ClientId);
                Guid coffeeId = (Guid)WarehouseApplication.BLL.Utility.GetCommodityId("Coffee");
                if (objCDR.CommodityId == coffeeId)
                {
                    LoadVoucherInformation(commDepositeId);
                    ViewState["hasVoucher"] = true;
                }
                else
                {
                    ViewState["hasVoucher"] = false;
                }
            }
        }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         this.Page.DataBind();
         if (Session["SamplingId"] != null)
         {
             Guid Id = Guid.Empty;
             Id = new Guid(Session["SamplingId"].ToString());
             Session["SamplingId"] = null;
             if (Id != Guid.Empty)
             {
                 SamplingBLL obj = new SamplingBLL();
                 obj    = obj.GetSampleDetail(Id);
                 obj.Id = Id;
                 if (obj != null)
                 {
                     this.lblSampleCode.Text       = obj.SampleCode;
                     this.txtDateCodeGenrated.Text = obj.GeneratedTimeStamp.ToShortDateString();
                     this.txtTimeArrival.Text      = obj.GeneratedTimeStamp.ToShortTimeString();
                     ViewState["SamplingId"]       = Id;
                     CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                     objCDR = objCDR.GetCommodityDepositeDetailById(obj.ReceivigRequestId);
                     if (objCDR != null)
                     {
                         lblArrivalDate.Text = objCDR.DateTimeRecived.ToShortDateString();
                     }
                 }
             }
         }
     }
 }
Exemple #3
0
        private void LoadDepositeRequest(Guid commDepositeId)
        {
            CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();

            objCDR = objCDR.GetCommodityDepositeDetailById(commDepositeId);
            if (objCDR != null)
            {
                //this.lblProductionYear.Text = objCDR.ProductionYear.ToString();
                this.lblDateRecived.Text       = objCDR.DateTimeRecived.ToString();
                this.lblTrackingNo.Text        = objCDR.TrackingNo;
                this.hfReceivigRequestId.Value = commDepositeId.ToString();
                this.hfWarehouseId.Value       = objCDR.WarehouseId.ToString();
                LoadClient(objCDR.ClientId);
            }
        }
Exemple #4
0
        private void LoadCommodity()
        {
            Guid GradingId = Guid.Empty;

            try
            {
                GradingId = new Guid(this.cboGradingCode.SelectedValue.ToString());
            }
            catch
            {
                this.lblMsg.Text = "Please Select Grading Code.";
                return;
            }
            if (GradingId == Guid.Empty)
            {
                this.lblMsg.Text = "Please Select Grading Code.";
                return;
            }
            GradingBLL objGrading = new GradingBLL();

            objGrading = objGrading.GetById(GradingId);
            Guid CommodityReciveingRequestId = Guid.Empty;

            if (objGrading != null)
            {
                CommodityReciveingRequestId = objGrading.CommodityRecivingId;
            }
            else
            {
                this.lblMsg.Text = "An error has occured please Try again.";
                return;
            }
            if (CommodityReciveingRequestId != Guid.Empty)
            {
                CommodityDepositeRequestBLL objCommDepReq = new CommodityDepositeRequestBLL();
                objCommDepReq = objCommDepReq.GetCommodityDepositeDetailById(CommodityReciveingRequestId);
                if (objCommDepReq != null)
                {
                    if (objCommDepReq.CommodityId != null)
                    {
                        this.cboCommodity_CascadingDropDown.ContextKey    = objCommDepReq.CommodityId.ToString();
                        this.cboCommodity_CascadingDropDown.SelectedValue = objCommDepReq.CommodityId.ToString();
                        this.cboCommodity.SelectedValue = objCommDepReq.CommodityId.ToString();
                        LoadGradingFactors(objCommDepReq.CommodityId);
                    }
                }
            }
        }
Exemple #5
0
        private void CoffeeCodingReport_ReportStart(object sender, EventArgs e)
        {
            Guid       CommodityDepositeId = Guid.Empty;
            Guid       WoredaId            = Guid.Empty;
            GradingBLL objCode             = new GradingBLL();

            if (HttpContext.Current.Session["CodeReport"] != null)
            {
                objCode = (GradingBLL)HttpContext.Current.Session["CodeReport"];
            }
            else
            {
                throw new Exception("Session expired.");
            }
            if (objCode != null)
            {
                this.txtDateCoded.Text = objCode.DateCoded.ToString("dd MMM-yyyy");
                this.txtCode.Text      = objCode.GradingCode.ToString();
                CommodityDepositeId    = objCode.CommodityRecivingId;
            }
            if (CommodityDepositeId != Guid.Empty)
            {
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailById(CommodityDepositeId);
                if (objCDR != null)
                {
                    WoredaId = objCDR.WoredaId;
                    WoredaBLL objWoreda = new WoredaBLL();
                    objWoreda = objWoreda.GetWoredabyId(WoredaId);
                    if (objWoreda != null)
                    {
                        this.txtOrigin.Text = objWoreda.WoredaName;
                    }
                }
            }
            this.txtDateGenerated.Text = DateTime.Now.ToString("dd MMM-yyyy");


            conn = Connection.getConnection();
            GradingByBLL objGradersReader = new GradingByBLL();

            reader = objGradersReader.GetGradersByGradingIdDataReader(objCode.Id, conn);
        }
Exemple #6
0
        protected void btnGenerateSampleTicket_Click(object sender, EventArgs e)
        {
            //

            Nullable <Guid> Id;
            Guid            WarehouseId        = UserBLL.GetCurrentWarehouse();
            Guid            Moistureid         = Guid.Empty;
            bool            isMoisture         = false;
            string          TransactionId      = String.Empty;
            Nullable <Guid> RecievingRequestId = null;

            try
            {
                if (this.chkReSampling.Checked == false)
                {
                    RecievingRequestId = SamplingBLL.GetRandomSample(WarehouseId);
                    isMoisture         = false;
                }
                else
                {
                    try
                    {
                        RecievingRequestId = SamplingBLL.GetRandomReSampling(WarehouseId, out Moistureid, out TransactionId);
                    }
                    catch (Exception ex)
                    {
                        this.lblMsg.Text = ex.Message;
                    }
                    isMoisture = true;
                }
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = ex.Message;
                return;
            }
            if (RecievingRequestId == null)
            {
                this.lblMsg.Text = "There are no records Pending Sampling";
                return;
            }

            Nullable <int> SerialNo  = null;
            SamplingBLL    objSample = new SamplingBLL();

            SerialNo = objSample.GetSerialNo(WarehouseId);
            if (SerialNo == null)
            {
                throw new Exception("Inavlid Serial No. exception");
            }
            // Create sampling obect

            SamplingBLL objSampling = new SamplingBLL();

            objSampling.ReceivigRequestId = (Guid)RecievingRequestId;
            objSampling.SamplingStatusId  = SamplingStatus.Active;
            objSampling.SerialNo          = SamplingBLL.GetSerial(WarehouseId);
            objSampling.WarehouseId       = WarehouseId;

            CommodityDepositeRequestBLL objCommDep = new CommodityDepositeRequestBLL();

            objCommDep = objCommDep.GetCommodityDepositeDetailById((Guid)RecievingRequestId);
            if (objCommDep != null)
            {
                if (string.IsNullOrEmpty(objCommDep.TrackingNo) == true)
                {
                    this.lblMsg.Text = "Can not get Tracking Number.Please try again.";
                    return;
                }
                else
                {
                    if (isMoisture == false)
                    {
                        objSampling.TrackingNo = objCommDep.TrackingNo;
                    }
                    else
                    {
                        objSampling.TrackingNo = TransactionId;
                    }
                }
            }
            else
            {
                throw new Exception("Unable to get Arrival Information CommDepId=" + RecievingRequestId.ToString());
            }

            //Create Sampler
            SamplerBLL objSampler = new SamplerBLL();

            try
            {
                objSampler.SamplerId = new Guid(this.cboSampler.SelectedValue.ToString());
            }
            catch
            {
                this.lblMsg.Text = "Please select Sampler";
                return;
            }

            objSampler.Status = SamplerStatus.Active;



            Id = objSampling.InsertSample(objSampling, objSampler, isMoisture);

            if (Id != null)
            {
                objSampling.Id = (Guid)Id;
                string tran = "";
                tran = SamplingBLL.GetTransactionNumber((Guid)RecievingRequestId);
                Session["Sampler"] = objSampler;
                Session["Sample"]  = objSampling;



                ScriptManager.RegisterStartupScript(this,
                                                    this.GetType(),
                                                    "ShowReport",
                                                    "<script type=\"text/javascript\">" +
                                                    string.Format("javascript:window.open(\"ReportSampleTicket.aspx?id={0}\", \"_blank\",\"height=400px,width=600px,top=0,left=0,resizable=yes,scrollbars=yes\");", Id.ToString()) +
                                                    "</script>",
                                                    false);
            }
            else
            {
                this.lblMsg.Text = "Data can not be saved.Please try again if the error persists contact the administrator.";
            }
        }
Exemple #7
0
        private void LoadData()
        {
            string str = "";
            Guid   Id;

            if (Session["GRID"] != null)
            {
                str = Session["GRID"].ToString();
            }
            if (str == "")
            {
                this.lblMsg.Text = "Unable to load data please try again.";
                return;
            }
            try
            {
                Id = new Guid(str);
                this.hfId.Value = Id.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to Update Data.", ex);
            }
            GradingResultBLL obj = new GradingResultBLL();

            obj = obj.GetGradingResultById(Id);

            if (obj != null)
            {
                this.cboGradingRecivedStatus.SelectedValue = ((int)obj.Status).ToString();
            }
            lblGradingReceivedDate.Text = obj.GradeRecivedTimeStamp.ToShortDateString();
            cmpSampGen.ValueToCompare   = obj.GradeRecivedTimeStamp.ToShortDateString();
            if (obj.GradingCode != null)
            {
                this.lblGradeCode.Text = obj.GradingCode;
            }
            this.lblClient.Text = "";
            string cg = "";
            CommodityDepositeRequestBLL obCD = new CommodityDepositeRequestBLL();

            obCD = obCD.GetCommodityDepositeDetailById(obj.CommodityDepositRequestId);
            ClientBLL objClient = new ClientBLL();

            objClient = ClientBLL.GetClinet(obCD.ClientId);
            if (objClient != null)
            {
                this.lblClient.Text = objClient.ClientName;
            }
            else
            {
                this.lblMsg.Text = "Unable to load client Data.";
            }

            cg = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId);
            this.lblCommodityGrade.Text = cg;
            if (((int)obj.Status == 3 || (int)obj.Status == 4) && obj.ClientAcceptanceTimeStamp != null)
            {
                this.cboAcceptanceStatus.SelectedValue = ((int)obj.Status).ToString();

                DateTime dtCA = DateTime.Now;
                if (obj.ClientAcceptanceTimeStamp == null)
                {
                    this.cboAcceptanceStatus.SelectedIndex = -1;
                }

                dtCA = (DateTime)obj.ClientAcceptanceTimeStamp;
                this.txtDateOfAcceptance.Text = dtCA.Date.ToShortDateString();
                this.txtTimeodAcceptance.Text = dtCA.ToLongTimeString();
                this.cboGradingRecivedStatus.SelectedValue = ((int)obj.GradingResult).ToString();
            }
        }
Exemple #8
0
        protected void btnGenerateCode_Click(object sender, EventArgs e)
        {
            bool isSaved = false;

            this.lblMsg.Text = "";
            string WarehouseNo;

            try
            {
                WarehouseNo = UserBLL.GetCurrentWarehouseCode();
            }
            catch
            {
                this.lblMsg.Text = "No warehouse code,please try agian.";
                return;
            }
            if (string.IsNullOrEmpty(WarehouseNo) == true)
            {
                this.lblMsg.Text = "No warehouse code,please try agian.";
                return;
            }
            if (string.IsNullOrEmpty(this.cboSampleCode.SelectedItem.Text) == true)
            {
                this.lblMsg.Text = "Please if the sample code exists";
                return;
            }

            string[] IdCollection = new string[3];
            IdCollection = this.cboSampleCode.SelectedValue.Split('/');
            Guid SamplingResultId  = Guid.Empty;
            Guid ReceivigRequestId = Guid.Empty;

            try
            {
                SamplingResultId  = new Guid(IdCollection[0].ToString());
                ReceivigRequestId = new Guid(IdCollection[1].ToString());
            }
            catch
            {
                this.lblMsg.Text = "Please if the sample code exists";
                return;
            }
            string     TrackingNo = IdCollection[2].ToString();
            DateTime   DateCoded  = DateTime.Parse(this.txtDateCodeGenrated.Text + " " + txtTimeArrival.Text);
            GradingBLL objGrading = new GradingBLL();

            if (SamplingResultId != Guid.Empty)
            {
                objGrading.SamplingResultId = SamplingResultId;
            }
            else
            {
                this.lblMsg.Text = "Please if the sample code exists";
                return;
            }
            if (ReceivigRequestId != Guid.Empty)
            {
                objGrading.CommodityRecivingId = ReceivigRequestId;
            }
            else
            {
                this.lblMsg.Text = "Please if the sample code exists";
                return;
            }
            objGrading.Status     = GradingStatus.Coded;
            objGrading.TrackingNo = TrackingNo;
            objGrading.CreatedBy  = UserBLL.GetCurrentUser();
            objGrading.DateCoded  = DateCoded;
            List <GradingByBLL> list = new List <GradingByBLL>();

            list = (List <GradingByBLL>)Session["Graders"];
            if (list == null)
            {
                this.lblMsg.Text = "Please provide graders.";
                return;
            }
            if (list.Count <= 0)
            {
                this.lblMsg.Text = "Please provide graders.";
                return;
            }
            if (isSingleSupervisorGrader(list) == false)
            {
                return;
            }
            Guid CommodityId = Guid.Empty;
            CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();

            objCDR = objCDR.GetCommodityDepositeDetailById(ReceivigRequestId);
            if (GradingByBLL.IsNumberofGraderAcceptable(list.Count, objCDR.CommodityId) == false)
            {
                this.lblMsg.Text = "The number of graders selected is less than the minimum required.";
                return;
            }

            if (list == null || list.Count <= 0)
            {
                this.lblMsg.Text = "Please add graders before generating code.";
                return;
            }
            if (this.hfTrackingNo.Value == "" || this.hfTrackingNo.Value == null)
            {
                this.lblMsg.Text = "An error has occured.";
                return;
            }
            isSaved = objGrading.Add(WarehouseNo, this.hfTrackingNo.Value.ToString(), list);
            if (isSaved == true)
            {
                // TODO Update a GridView dataBind and print the Coding Ticket.
                this.lblMsg.Text = "Data Added Successfully.";
                CommodityDepositeRequestBLL obj = new CommodityDepositeRequestBLL();
                Session["Graders"]       = null;
                this.gvGrader.DataSource = null;
                this.gvGrader.DataBind();
                this.pnlGradingDetail.Visible = false;
                this.btnGenerateCode.Visible  = false;
                LoadCode(objGrading.SamplingResultId);
            }
            else
            {
                this.lblMsg.Text = "Data can not be saved. Please check the data entered and try again.If the error persists, conatact the IT support.";
            }
        }