示例#1
0
        private bool doValidMain()
        {
            Messages.ClearMessage();
            if (txtDateOfAcceptance.Text.Trim() == string.Empty)
            {
                Messages.SetMessage("Please enter date of acceptance.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }
            if (lblGradingReceivedDateValue.Text.Trim() == string.Empty)
            {
                Messages.SetMessage(" Please enter grading received date.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }
            if (Convert.ToDateTime(txtDateOfAcceptance.Text + " " + txtTimeodAcceptance.Text) <= Convert.ToDateTime(lblGradingReceivedDateValue.Text))
            {
                Messages.SetMessage("Date of acceptance must be later than Grading received date.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }

            if (cboAcceptanceStatus.SelectedIndex == 0)
            {
                Messages.SetMessage("Status is required.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }
            return(true);
        }
示例#2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            GradingModel gModel;

            if (Session["gModel"] == null)
            {
                gModel = new GradingModel();
                Session.Add("gModel", gModel);
            }
            else
            {
                gModel = (GradingModel)Session["gModel"];
            }
            try
            {
                gModel.AddGrader(new Guid(drpGrader.SelectedValue), chkIsSupervisor.Checked);
            }
            catch (Exception ex)
            {
                Messages.SetMessage(ex.Message.ToString(), WarehouseApplication.Messages.MessageType.Error);
            }

            gvGradingBy.DataSource = gModel.gradinginfoList;
            gvGradingBy.DataBind();
        }
示例#3
0
        protected void btnAddWoreda_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            if (ViewState["ClassWoreda"] == null)
            {
                Messages.SetMessage("Please select one item from the Grid!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            List <woreda> classWoreda = (List <woreda>)ViewState["ClassWoreda"];

            if (!classWoreda.Exists(w => w.WoredaID == cboWoreda.SelectedValue))
            {
                woreda w = new woreda();
                w.WoredaID   = cboWoreda.SelectedValue;
                w.WoredaName = cboWoreda.SelectedItem.Text;
                classWoreda.Insert(0, w);
                ViewState["ClassWoreda"] = classWoreda;

                gvClassWereda.DataSource = classWoreda;
                gvClassWereda.DataBind();
            }
            else
            {
                Messages.SetMessage("Woreda entered already exists!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            Messages.ClearMessage();
            Page.DataBind();
            btnNext.Enabled               = false;
            btnNext.BackColor             = System.Drawing.Color.LightGray;
            chkIsSourceDetermined.Checked = true;
            if (SessionKeyExists(SessionKey.Arrival))
            {
                //Response.Redirect("ErrorPage.aspx");
                //return;
            }
            this.btnSave.UseSubmitBehavior = false;
            btnSave.OnClientClick          = "javascript:";

            if (btnSave.CausesValidation)
            {
                btnSave.OnClientClick += " if ( Page_ClientValidate('" + btnSave.ValidationGroup + "') ){ ";
                btnSave.OnClientClick += "this.disabled=true; this.value='Please Wait...'; }";
            }

            if (theArrival == null)
            {
                theArrival = new ArrivalModel();
                Response.Redirect("ErrorPage.aspx");
                return;
            }
            theArrival.RefreshAll();
            FillControls();
            //populateWashingStation();
            populateclientcert();
            PopulateExistingData();
            populateVehicleSize();
            GetCommodityTypes();
            if (cboCommodity.SelectedIndex == 0)
            {
                cboCommodityType.Enabled  = false;
                RFVCoffeeType.Enabled     = false;
                DDLwashingstation.Enabled = false;
                DDlvehiclesize.Enabled    = false;
            }
            else
            {
                if (cboCommodityType.Items.Count == 1)
                {
                    cboCommodityType.Enabled = false;
                    RFVCoffeeType.Enabled    = false;
                }
                else
                {
                    cboCommodityType.Enabled = true;
                    RFVCoffeeType.Enabled    = true;
                }
            }
        }
示例#5
0
        protected void btnReloadForResample_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton lb         = (ImageButton)sender;
            int         searchCase = lb.ID == "lbtnReloadForNew" ? 1 : lb.ID == "lbtnReloadForDriverMissing" ? 2 : 3;

            populateGrid(searchCase);
            Messages.ClearMessage();
            UpdatePanel4.Update();
        }
示例#6
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            string ginApprovalInfoXML = "<PSAApproval>";
            string errorMsg = ""; DateTime dtValue = new DateTime();

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    DropDownList cStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpClientStatus");
                    if (cStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the client signed status must me selected! ";
                    }
                    DropDownList licStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpLICStatus");
                    if (licStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the LIC signed status must me selected! ";
                    }
                    TextBox cdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeClientSigned");
                    TextBox ctime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeClientSigned");
                    if (!DateTime.TryParse(cdate.Text + " " + ctime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current Client signed date and time! ";
                    }
                    TextBox licdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned");
                    TextBox lictime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned");
                    if (!DateTime.TryParse(licdate.Text + " " + lictime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current LIC signed date and time! ";
                    }
                    if (errorMsg != string.Empty)
                    {
                        errorMsg = "For the PSA with number '" + ((Label)gvr.FindControl("lblPSA")).Text + "' " + errorMsg;
                        Messages.SetMessage(errorMsg, WarehouseApplication.Messages.MessageType.Error);
                        return;
                    }
                    ginApprovalInfoXML +=
                        "<PSAApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Value.ToString() + "</ID>" +
                        "<ClientSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeClientSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeClientSigned")).Text + "</ClientSignedDate>" +
                        "<ClientSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ClientSignedName>" +
                        "<LICSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text + "</LICSignedDate>" +
                        "<LICSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</LICSignedName>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "<UserId>" + BLL.UserBLL.CurrentUser.UserId + "</UserId>" +
                        "</PSAApprovalItem>";
                }
            }
            ginApprovalInfoXML += "</PSAApproval>";
            GINModel.ApprovePSA(ginApprovalInfoXML);
            Messages.SetMessage("SUCCESS: The PSA Approved and it is out of unapproved list!", Messages.MessageType.Success);
            btnApprove.Style["visibility"] = "hidden";
            BindData();
        }
示例#7
0
        protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView gv         = (GridView)sender;
            int      searchCase = gv.ID == "gvWaitingForSampling" ? 1 : gv.ID == "gvWaitForDriver" ? 2 : 3;

            gv.PageIndex = e.NewPageIndex;
            populateGrid(searchCase);
            Messages.ClearMessage();
            UpdatePanel4.Update();
        }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         FillRegion(cboRegion);
         FillZone();
         FillWorada();
     }
     Messages.ClearMessage();
     UpdatePanel1.Update();
 }
示例#9
0
        private void SaveSampling(GridView gv)
        {
            //  this.lblMessage.Visible = false;

            Messages.ClearMessage();

            SamplingModel sampleModel = SetSampling(gv);

            UpdatePanel4.Update();
            if (sampleModel == null)
            {
                return;
            }

            try
            {
                sampleModel.Save();
            }
            catch (Exception ex)
            {
                if (ex.Message.ToUpper().Contains("Sample Code".ToUpper()))
                {
                    string msg = ex.Message.Split('|').First(s => s.ToUpper().Contains("Sample Code".ToUpper()));
                    Messages.SetMessage(msg, Messages.MessageType.Error);
                    return;
                }
                else
                {
                    throw;
                }
            }

            //Repopulate the grid
            int searchCase = gv.ID == "gvWaitingForSampling" ? 1 : gv.ID == "gvWaitForDriver" ? 2 : 3;

            populateGrid(searchCase, true);

            Session["ReportType"] = "SampleTicket";
            Session["SampleId"]   = sampleModel.ID;
            ScriptManager.RegisterStartupScript(this,
                                                this.GetType(),
                                                "ShowReport",
                                                "<script type=\"text/javascript\">" +
                                                string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                "</script>",
                                                false);
        }
示例#10
0
        void Save()
        {
            Messages.ClearMessage();
            if (gvCommodityClassGrade.SelectedIndex < 0 && gvCommodityGrade.SelectedIndex < 0)
            {
                Messages.SetMessage("Please select one item from the Grid!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            ModelCommoditySymbol mcs = new ModelCommoditySymbol();

            SetValues(mcs);
            mcs.Save();
            lbtnReload_Click(null, null);
            Messages.SetMessage("Record saved successfully!", WarehouseApplication.Messages.MessageType.Success);
        }
示例#11
0
        //protected override void OnInit(EventArgs e)
        //{

        //    base.OnInit(e);

        //    this.btnSave.UseSubmitBehavior = false;
        //    btnSave.OnClientClick = "javascript:";

        //    if (btnSave.CausesValidation)
        //    {
        //        btnSave.OnClientClick += " if ( Page_ClientValidate('" + btnSave.ValidationGroup + "') ){ ";
        //        btnSave.OnClientClick += "this.disabled=true; this.value='Please Wait...'; }";
        //    }
        //}

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnNext.Enabled   = false;
                btnNext.BackColor = System.Drawing.Color.LightGray;
                this.btnSave.UseSubmitBehavior = false;
                btnSave.OnClientClick          = "javascript:";

                if (btnSave.CausesValidation)
                {
                    btnSave.OnClientClick += " if ( Page_ClientValidate('" + btnSave.ValidationGroup + "') ){ ";
                    btnSave.OnClientClick += "this.disabled=true; this.value='Please Wait...'; }";
                }
            }
            Messages.ClearMessage();
        }
示例#12
0
        protected void lbtnReload_Click(object sender, EventArgs e)
        {
            Clear();
            Messages.ClearMessage();
            if (cboCommodity.SelectedIndex < 0)
            {
                Messages.SetMessage("Commodity selected is invalid!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }
            Guid commodityID = new Guid(cboCommodity.SelectedValue);

            if (sender != null)
            {
                ViewState["PageIndex"] = 0;
            }
            if (rbCommodityClassGrade.SelectedValue == "1")
            {
                FillCommoditySymbolGrid(gvCommodityClassGrade, commodityID);
                FillGradingFactorGroup(commodityID);
                if (ViewState["COFFEEID"].ToString().ToUpper().Equals(commodityID.ToString().ToUpper()))
                {
                    FillCommodityType();
                    rfdrpCommodityType.Enabled = true;
                    drpCommodityType.Enabled   = true;
                }
                else
                {
                    drpCommodityType.Items.Clear();
                    rfdrpCommodityType.Enabled = false;
                    drpCommodityType.Enabled   = false;
                }
            }
            else
            {
                FillCommoditySymbolGrid(gvCommodityGrade, commodityID);
                FillCommodityClass(commodityID);
                FillCommodityClassifications(commodityID);
            }
            upClass.Update();
            upGrade.Update();
            UpdatePanel1.Update();
        }
示例#13
0
 protected void drpType_SelectedIndexChanged(object sender, EventArgs e)
 {
     Messages.ClearMessage();
     if (drpWarehouse.SelectedValue == "")
     {
         Messages.SetMessage("Warehouse is required", WarehouseApplication.Messages.MessageType.Warning);
         return;
     }
     if (Convert.ToInt32(drpType.SelectedValue) == (int)WareHouseOperatorTypeEnum.LIC)
     {
         lblShed.Visible = true;
         drpShed.Visible = true;
         FillShed();
     }
     else
     {
         lblShed.Visible = false;
         drpShed.Visible = false;
     }
 }
示例#14
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            string psaApprovalInfoXML = "<PSAApproval>";
            string errorMsg = ""; DateTime dtValue = new DateTime();

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    DropDownList mStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpManagerStatus");
                    if (mStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the client signed status must me selected! ";
                    }
                    TextBox mdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeManagerSigned");
                    TextBox mtime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeManagerSigned");
                    if (!DateTime.TryParse(mdate.Text + " " + mtime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current client signed date time is invalid! ";
                    }
                    if (errorMsg != string.Empty)
                    {
                        errorMsg = "For the PSA with number '" + gvr.Cells[1].Text + "' " + errorMsg;
                        Messages.SetMessage(errorMsg, WarehouseApplication.Messages.MessageType.Error);
                        return;
                    }

                    psaApprovalInfoXML +=
                        "<PSAApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Values["Id"].ToString() + "</ID>" +
                        "<ManagerSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeManagerSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeManagerSigned")).Text + "</ManagerSignedDate>" +
                        "<ManagerSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ManagerSignedName>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "</PSAApprovalItem>";
                }
            }
            psaApprovalInfoXML += "</PSAApproval>";
            GINModel.ApproveManagerPSA(psaApprovalInfoXML);
            Messages.SetMessage("SUCCESS: The PSA Approved and it is out of unapproved list!", Messages.MessageType.Success);
            BindData();
        }
示例#15
0
        private void populateGrid()
        {
            List <SamplingModelDetail> ls = null;

            ls = SamplingModel.GetSamplesDetail(UserBLL.GetCurrentWarehouse(), txtTrackNo.Text.Trim(), txtSampleCode.Text.Trim(), int.Parse(cboSampleStatus.SelectedValue));
            //if (ls != null && ls.Count > 0)
            // {
            this.gvSampleTicketList.DataSource = ls;
            this.gvSampleTicketList.DataBind();
            this.gvSampleTicketList.SelectedIndex = 0;
            // }
            if (ls == null || ls.Count <= 0)
            {
                Messages.SetMessage("There is no Sampling with the given tracking No.!", WarehouseApplication.Messages.MessageType.Warning);
            }
            else
            {
                Messages.ClearMessage();
            }
            UpdatePanel1.Update();
        }
示例#16
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            if (!txtExpirationDateFrom.Text.Equals(string.Empty))
            {
                Session["ExpirationDateFrom"] = Convert.ToDateTime(txtExpirationDateFrom.Text);
            }
            else
            {
                Session["ExpirationDateFrom"] = DateTime.Now;
            }
            if (!txtExpirationDateTo.Text.Equals(string.Empty))
            {
                Session["ExpirationDateTo"] = Convert.ToDateTime(txtExpirationDateTo.Text);
            }


            else
            {
                Session["ExpirationDateTo"] = DateTime.Now.AddYears(-10);
            }

            if (Convert.ToDateTime(txtExpirationDateTo.Text) < Convert.ToDateTime(txtExpirationDateFrom.Text))
            {
                Messages.SetMessage("Expiration Date From must be prior (less than) to Expiration Date To .", Messages.MessageType.Warning);
            }
            else
            {
                Session["ReportType"] = "ExpierdList";
                ScriptManager.RegisterStartupScript(this,
                                                    this.GetType(),
                                                    "ShowReport",
                                                    "<script type=\"text/javascript\">" +
                                                    string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=2000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +
                                                    "</script>",
                                                    false);
            }
        }
示例#17
0
        /// <summary>
        /// Get all the Arrivals which are Ready for sampling.
        /// Display them based on their order(CreatedTimeStamp)
        /// </summary>
        private void populateGrid(int _case, bool afterSave = false)
        {
            Messages.ClearMessage();
            List <ArrivalForSampling> ls   = null;
            List <ArrivalForSampling> lsNA = null;
            List <ArrivalForSampling> lsDM = null;
            List <ArrivalForSampling> lsMF = null;

            ls = SamplingModel.GetArrivalsReadyForSampling(UserBLL.GetCurrentWarehouse(), _case, txtTrackingNo.Text.Trim(),
                                                           txtPreSampleCode.Text.Trim(), txtPreGradingCode.Text.Trim());
            lsNA = ls.Where(s => s.SamplingStatusID.Equals(0)).ToList();
            lsDM = ls.Where(s => s.SamplingStatusID == (int)SamplingBussiness.SamplingStatus.DriverNotFound).ToList();
            lsMF = ls.Where(s => s.SamplingStatusID != (int)SamplingBussiness.SamplingStatus.DriverNotFound && !s.SamplingStatusID.Equals(0)).ToList();
            if (_case == 0 || _case == 1)
            {
                this.gvWaitingForSampling.DataSource = lsNA;
                this.gvWaitingForSampling.DataBind();
                this.gvWaitingForSampling.SelectedIndex = 0;
            }
            if (_case == 0 || _case == 2)
            {
                this.gvWaitForDriver.DataSource = lsDM;
                this.gvWaitForDriver.DataBind();
                this.gvWaitForDriver.SelectedIndex = 0;
            }
            if (_case == 0 || _case == 3)
            {
                this.gvWaitForReSamle.DataSource = lsMF;
                this.gvWaitForReSamle.DataBind();
                this.gvWaitForReSamle.SelectedIndex = 0;
            }
            if (gvWaitForDriver.Rows.Count <= 0 && gvWaitForReSamle.Rows.Count <= 0 && gvWaitingForSampling.Rows.Count <= 0 &&
                (ls == null || ls.Count <= 0) && !afterSave)
            {
                Messages.SetMessage("No truck available for sampling. Please wait.", WarehouseApplication.Messages.MessageType.Warning);
            }
        }
示例#18
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     Messages.ClearMessage();
     BindData();
 }
示例#19
0
        protected void btnSaveSampleResult_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();

            //int no = 0;
            //if (((int)SamplingBussiness.SamplingStatus.DriverNotFound) != int.Parse(rbSampleStatus.SelectedValue) &&
            //    txtArrivalNoOfBags.Text.Trim() != string.Empty &&
            //    int.TryParse(txtArrivalNoOfBags.Text, out no) &&
            //    no < int.Parse(txtNumberOfBags.Text))
            //{
            //    Messages.SetMessage("Bag count greater than the bag count " + no + " registered on Voucher!", WarehouseApplication.Messages.MessageType.Error);
            //    return;
            //}
            if (ViewState["SelectedSMID"] == null)
            {
                Messages.SetMessage("The sample ticket dosen't exits. Please try reloading again!", WarehouseApplication.Messages.MessageType.Error);
                return;
            }
            //SamplingModel sm = (SamplingModel)ViewState["SelectedSMID"];
            SamplingModel sm = SamplingModel.GetSampleById(new Guid(ViewState["SelectedSMID"].ToString()));

            if (sm == null)
            {
                Messages.SetMessage("The sample ticket dosen't exits. Please try reloading again!", WarehouseApplication.Messages.MessageType.Error);
                return;
            }
            sm.ResultReceivedDateTime = DateTime.Parse(txtResultReceivedDate.Text + " " + txtResultReceivedTime.Text);
            sm.SamplingStatusID       = int.Parse(rbSampleStatus.SelectedValue);
            if (((int)SamplingBussiness.SamplingStatus.DriverNotFound) != int.Parse(rbSampleStatus.SelectedValue))
            {
                if (!chkIsPlompOk.Checked && txtSamplerComments.Text.Trim().Length <= 0)
                {
                    Messages.SetMessage("Please enter the remark since the plomp ok is not checked!", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }
                int noOfbag = 0;
                if (!int.TryParse(txtNumberOfBags.Text, out noOfbag))
                {
                    Messages.SetMessage("Please enter a valid number of bags!", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }
                sm.NumberOfBags = noOfbag;
                if (drpBagType.SelectedIndex <= 0)
                {
                    Messages.SetMessage("Please select Bag Type!", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }
                sm.BagTypeID       = new Guid(drpBagType.SelectedValue);
                sm.SamplerComments = txtSamplerComments.Text;
                sm.PlompStatusID   = (int)(chkIsPlompOk.Checked ? PlompStatus.PlompOK : PlompStatus.PlompNotOk);
                // sm.SupervisorApprovalRemark = ""; txtSuppervisorApprovalRemark.Text;
                //sm.SupervisorApprovalDateTime = DateTime.Parse(txtSupperVisorApprovalDate.Text);
                sm.HasLiveInsect       = chkHasLiveInsect.Checked;
                sm.HasMoldOrFungus     = chkHasMoldOrFungus.Checked;
                sm.HasChemicalOrPetrol = chkHasChemicalOrPetrol.Checked;
                reqRemark.Enabled      = !chkIsPlompOk.Checked;
            }
            sm.LastModifiedBy        = BLL.UserBLL.CurrentUser.UserId;
            sm.LastModifiedTimestamp = DateTime.Now;

            try
            {
                sm.Save();


                int    no  = 0;
                string msg = "";
                if (((int)SamplingBussiness.SamplingStatus.DriverNotFound) != int.Parse(rbSampleStatus.SelectedValue) &&
                    txtArrivalNoOfBags.Text.Trim() != string.Empty &&
                    int.TryParse(txtArrivalNoOfBags.Text, out no) &&
                    no < int.Parse(txtNumberOfBags.Text))
                {
                    msg = "Bag count greater than the bag count " + no + " registered on Voucher!";
                }
                //PopulateCombo(sm.CommodityID,sm.VoucherCommodityTypeID);
                //Clear(true);

                if (msg == string.Empty)
                {
                    Messages.SetMessage("Record saved successfully! ", WarehouseApplication.Messages.MessageType.Success);
                }
                else
                {
                    Messages.SetMessage("Record saved successfully! " + msg, WarehouseApplication.Messages.MessageType.Warning);
                }
                btnSaveSampleResult.Visible = false;
            }
            catch (Exception ex)
            {
                Messages.SetMessage(ex.Message, WarehouseApplication.Messages.MessageType.Error);
            }
        }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            if (!IsPostBack)
            {
                Page.DataBind();
                if (Request.QueryString["CommandName"] == null)
                {
                    //change to zaid.
                    Messages.ClearMessage();
                    return;
                }
                ViewState["CommandName"] = Request.QueryString["CommandName"];

                if (ViewState["CommandName"].ToString() == "Insert")
                {
                    ViewState["GradingCode"] = Request.QueryString["GradingCode"].ToString();
                }
                else if (ViewState["CommandName"].ToString() == "Update")
                {
                    ViewState["GradingCode"] = Session["GradingCode_Search"].ToString();
                }
                else
                {
                    return;
                }

                if (string.IsNullOrEmpty(ViewState["GradingCode"].ToString()))
                {
                    //change to zaid.
                    Messages.ClearMessage();
                    return;
                }

                //HttpContext.Current.Session["TrackingNumber_GRN"] = Request.QueryString["TranNo"];
                HttpContext.Current.Session["ArrivalId_GRN"]        = null; //Initialized at LoadDisplayInfo() function
                HttpContext.Current.Session["GradeId_GRN"]          = null;
                HttpContext.Current.Session["CommodityGradeId_GRN"] = null;
                HttpContext.Current.Session["ShedId_GRN"]           = null;
                HttpContext.Current.Session["LICID_GRN"]            = null;

                HttpContext.Current.Session["GRNId_GRN"] = null; //Setted at InitializeInstance() function
                ViewState["GRNID"] = null;                       //setted at displayInfo() function

                string GradingCode = ViewState["GradingCode"].ToString();
                LoadDisplayInfo(GradingCode);

                cboShed.Enabled = false;

                if (ViewState["CommandName"].ToString() == "Insert")
                {
                    //Make submit button to Save
                    btnPrintGrn.Enabled = false;
                    btnSave.Text        = "Save";
                    btnNext.Enabled     = false;
                    LoadControls();
                }
                else if (ViewState["CommandName"].ToString() == "Update")
                {
                    //Populate data for update
                    //Change Save button to Update
                    LoadControls();
                    PopulateInformation();
                    btnPrintGrn.Enabled        = true;
                    btnNext.Enabled            = true;
                    Session["CommandType_GRN"] = null;
                }
                else
                {
                    LoadControls();
                    //Redirect to Error page and
                    //Display session expired message
                }
            }
        }
示例#21
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (doValidMain())
            {
                GradingModel objSave = new GradingModel();
                if ((bool)(Session["EditMode"]))
                {
                    objSave.Edit = true;
                }
                else
                {
                    objSave.Edit = false;
                }
                objSave.ID          = new Guid(ViewState["ID"].ToString());
                objSave.GradingCode = ViewState["GradingCode"].ToString();
                if (txtSegrigationNo.Visible)
                {
                    Messages.ClearMessage();
                    if (txtSegrigationNo.Text.Trim() == string.Empty)
                    {
                        Messages.SetMessage("Segrigation No is required .", WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }
                    if (cboAcceptanceStatus.SelectedIndex == 0)
                    {
                        Messages.SetMessage("Status is required .", WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }
                    objSave.NumberofSeparations   = int.Parse(txtSegrigationNo.Text);
                    objSave.GradingResultStatusID = Convert.ToInt32(cboGradingRecivedStatus.SelectedValue.ToString());
                    objSave.GradingsStatusID      = Convert.ToInt32(cboAcceptanceStatus.SelectedValue.ToString());
                    objSave.UserId = BLL.UserBLL.GetCurrentUser();
                    objSave.UpdateAcceptanceForSeg();
                    btnUpdate.Visible = false;
                    btnNext.Visible   = true;
                    Messages.SetMessage("Record updated successfully.", WarehouseApplication.Messages.MessageType.Success);
                    btnPrint.Visible = true;
                    return;
                }
                if (cboAcceptanceStatus.SelectedValue.ToString() == "4")
                {
                    Messages.ClearMessage();
                    if (txtCashReceiptNo.Text.Trim() == string.Empty)
                    {
                        Messages.SetMessage("Cash Receipt No is required .", WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }
                    if (txtAmount.Text.Trim() == string.Empty)
                    {
                        Messages.SetMessage("Amount is required .", WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }
                    objSave.LICID         = Guid.Empty;
                    objSave.ShedID        = Guid.Empty;
                    objSave.ShedNo        = string.Empty;
                    objSave.CashReceiptNo = txtCashReceiptNo.Text;
                    objSave.Amount        = Convert.ToDecimal(txtAmount.Text);
                }
                else if (cboAcceptanceStatus.SelectedValue.ToString() == "5")
                {
                    objSave.LICID         = Guid.Empty;
                    objSave.ShedID        = Guid.Empty;
                    objSave.ShedNo        = string.Empty;
                    objSave.CashReceiptNo = string.Empty;
                    objSave.Amount        = 0;
                }
                else if (cboAcceptanceStatus.SelectedValue.ToString() == "3")
                {
                    Messages.ClearMessage();
                    if (drpLIC.SelectedIndex == 0)
                    {
                        Messages.SetMessage("LIC is required .", WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }
                    if (drpShed.SelectedIndex == 0)
                    {
                        Messages.SetMessage("Shed is required .", WarehouseApplication.Messages.MessageType.Warning);
                        return;
                    }
                    objSave.LICID         = new Guid(drpLIC.SelectedValue);
                    objSave.ShedID        = new Guid(drpShed.SelectedValue);
                    objSave.ShedNo        = drpShed.SelectedItem.Text;
                    objSave.CashReceiptNo = string.Empty;
                    objSave.Amount        = 0;
                }
                objSave.UserId = BLL.UserBLL.GetCurrentUser();
                objSave.ClientAcceptanceTimeStamp = Convert.ToDateTime(txtDateOfAcceptance.Text + " " + txtTimeodAcceptance.Text);
                objSave.GradingResultStatusID     = Convert.ToInt32(cboGradingRecivedStatus.SelectedValue.ToString());
                objSave.GradingsStatusID          = Convert.ToInt32(cboAcceptanceStatus.SelectedValue.ToString());

                if (drpSecurityMarshal.SelectedIndex == 0)
                {
                    objSave.SecurityMarshalID = Guid.Empty;
                }
                else
                {
                    objSave.SecurityMarshalID = new Guid(drpSecurityMarshal.SelectedValue);
                }
                objSave.UpdateAcceptance();
                btnNext.Visible = true;
                Messages.SetMessage("successfully Updated.", WarehouseApplication.Messages.MessageType.Success);
                btnPrint.Visible  = true;
                btnUpdate.Visible = false;
            }
        }
示例#22
0
        protected void gvCommodityClassGrade_SelectedIndexChanged(object sender, EventArgs e)
        {
            Messages.ClearMessage();

            Label lbl = null;
            Label lblCommodityType = null;

            if (rbCommodityClassGrade.SelectedValue == "1")
            {
                GridViewRow gvr = gvCommodityClassGrade.SelectedRow;
                lbl = (Label)gvr.FindControl("lblGradingFactorGroupID");
                lblCommodityType = (Label)gvr.FindControl("lblCommodityType");
                if (lblCommodityType.Text.Trim() != string.Empty)
                {
                    drpCommodityType.SelectedValue = lblCommodityType.Text.Trim();
                }
                chkInActiveClass.Checked = chkShowInActive.Checked;
                if (lbl.Text.Trim() != string.Empty)
                {
                    try
                    {
                        cboFactorGroup.SelectedValue = lbl.Text;
                    }
                    catch { Messages.SetMessage("The Factor group of the class don't exits in the list.Please select other!", WarehouseApplication.Messages.MessageType.Error); }
                }
                lbl = (Label)gvr.FindControl("lblID");
                FillWoredaGrid(new Guid(lbl.Text));
                upClass.Update();
            }
            else
            {
                GridViewRow gvr = gvCommodityGrade.SelectedRow;
                lbl = (Label)gvr.FindControl("lblParentID");
                chkInActiveGrade.Checked = chkShowInActive.Checked;
                if (lbl.Text.Trim() != string.Empty)
                {
                    try
                    {
                        cboCommodityClass.SelectedValue = lbl.Text;
                    }
                    catch { Messages.SetMessage("The class of the grade don't exits in the class list.Please select other", WarehouseApplication.Messages.MessageType.Error); }
                }
                else if (cboCommodityClass.Items.Count > 0)
                {
                    cboCommodityClass.SelectedIndex = 0;
                }
                lbl = (Label)gvr.FindControl("lblMinimumTotalValue");
                txtMinTotalValue.Text = lbl.Text;
                lbl = (Label)gvr.FindControl("lblMaximumTotalValue");
                txtMaxTotalValue.Text = lbl.Text;
                lbl = (Label)gvr.FindControl("lblGrade");
                txtGradeValue.Text = lbl.Text;
                lbl = (Label)gvr.FindControl("lblClassificationNo");
                if (lbl.Text.Trim() != string.Empty)
                {
                    int no = 0;
                    int.TryParse(lbl.Text, out no);
                    foreach (ListItem li in chkList.Items)
                    {
                        li.Selected = no > 0 && no % int.Parse(li.Value) == 0 ? true : false;
                    }
                    rbList.SelectedValue = no.ToString();
                }
                else
                {
                    //foreach (ListItem li in chkList.Items)
                    //{
                    //    li.Selected = false;
                    //}
                    rbList.SelectedIndex = -1; chkList.SelectedIndex = -1;
                }
                upGrade.Update();
            }
            UpdatePanel1.Update();
        }
示例#23
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            if (txtClientId.Text.Equals(string.Empty))
            {
                Session["ClientId"] = string.Empty;
            }
            else
            {
                Session["ClientId"] = txtClientId.Text;
                if (drpStatus.SelectedIndex == 0)
                {
                    Messages.SetMessage("PUN search is not allowed by Client Id only, but you can search by Client Id in combination with Status and/or Expiration Date.", Messages.MessageType.Warning);
                }
            }
            if (txtWareHouseReceipt.Text.Equals(string.Empty))
            {
                Session["WareHouseReceipt"] = 0;
            }
            else
            {
                Session["WareHouseReceipt"] = txtWareHouseReceipt.Text;
            }
            if (!txtExpirationDateFrom.Text.Equals(string.Empty))
            {
                Session["ExpirationDateFrom"] = Convert.ToDateTime(txtExpirationDateFrom.Text);
            }
            else
            {
                Session["ExpirationDateFrom"] = DateTime.Now.AddYears(-1);
            }
            if (!txtExpirationDateTo.Text.Equals(string.Empty))
            {
                Session["ExpirationDateTo"] = Convert.ToDateTime(txtExpirationDateTo.Text).AddDays(1).AddSeconds(-1);
            }
            else
            {
                Session["ExpirationDateTo"] = DateTime.Now.AddYears(1);
            }

            Session["Status"] = drpStatus.SelectedItem.Value;
            if (Convert.ToInt32(drpStatus.SelectedItem.Value) == Convert.ToInt32(PickupNoticeStatusEnum.OpenExpiered))
            {
                if (!txtExpirationDateFrom.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateFrom"] = Convert.ToDateTime(txtExpirationDateFrom.Text);
                }
                else
                {
                    Session["ExpirationDateFrom"] = DateTime.Now.AddYears(-1);
                }
                if (!txtExpirationDateTo.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateTo"] = Convert.ToDateTime(txtExpirationDateTo.Text).AddDays(1).AddSeconds(-1);
                    if (Convert.ToDateTime(txtExpirationDateTo.Text) < Convert.ToDateTime(txtExpirationDateFrom.Text))
                    {
                        Messages.SetMessage("Expiration Date From must be prior (less than) to Expiration Date To .", Messages.MessageType.Warning);
                    }
                }
                else
                {
                    Session["ExpirationDateTo"] = DateTime.Now.AddDays(1).AddSeconds(-1);
                }
                Session["Status"] = 0;
            }
            if (Convert.ToInt32(drpStatus.SelectedItem.Value) == Convert.ToInt32(PickupNoticeStatusEnum.OpenActive))
            {
                if (!txtExpirationDateFrom.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateFrom"] = Convert.ToDateTime(txtExpirationDateFrom.Text);
                }
                else
                {
                    Session["ExpirationDateFrom"] = DateTime.Now;
                }
                if (!txtExpirationDateTo.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateTo"] = Convert.ToDateTime(txtExpirationDateTo.Text).AddDays(1).AddSeconds(-1);
                }
                else
                {
                    Session["ExpirationDateTo"] = DateTime.Now.AddYears(10);
                }
                Session["Status"] = 0;
            }
            if (Convert.ToInt32(drpStatus.SelectedItem.Value) == Convert.ToInt32(PickupNoticeStatusEnum.BeingIssuedExpiered))
            {
                if (!txtExpirationDateFrom.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateFrom"] = Convert.ToDateTime(txtExpirationDateFrom.Text);
                }
                else
                {
                    Session["ExpirationDateFrom"] = DateTime.Now.AddYears(-1);
                }
                if (!txtExpirationDateTo.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateTo"] = Convert.ToDateTime(txtExpirationDateTo.Text).AddDays(1).AddSeconds(-1);
                }
                else
                {
                    Session["ExpirationDateTo"] = DateTime.Now.AddDays(1).AddSeconds(-1);
                }
                Session["Status"] = 1;
            }
            if (Convert.ToInt32(drpStatus.SelectedItem.Value) == Convert.ToInt32(PickupNoticeStatusEnum.BeingIssued))
            {
                if (!txtExpirationDateFrom.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateFrom"] = Convert.ToDateTime(txtExpirationDateFrom.Text);
                }
                else
                {
                    Session["ExpirationDateFrom"] = DateTime.Now;
                }
                if (!txtExpirationDateTo.Text.Equals(string.Empty))
                {
                    Session["ExpirationDateTo"] = Convert.ToDateTime(txtExpirationDateTo.Text).AddDays(1).AddSeconds(-1);
                }
                else
                {
                    Session["ExpirationDateTo"] = DateTime.Now.AddYears(10);
                }
                Session["Status"] = 1;
            }
            lstSerch.Search(Session["ClientId"].ToString(), Convert.ToInt32(Session["WareHouseReceipt"]), Session["Status"].ToString(), UserBLL.GetCurrentWarehouse(), Convert.ToDateTime(Session["ExpirationDateFrom"]), Convert.ToDateTime(Session["ExpirationDateTo"]));

            gvSearchPickupNotice.DataSource = lstSerch.lstSerchList;
            try
            {
                gvSearchPickupNotice.DataBind();
            }
            catch { }
            if (lstSerch.lstSerchList.Count > 0 && !txtClientId.Text.Equals(string.Empty) && Convert.ToInt32(drpStatus.SelectedItem.Value) != 0)
            {
                Messages.SetMessage("If you search using client ID and status other than open status the system give you recently expiring 50 puns; please use Ware house receipt No to get specific data.", Messages.MessageType.Warning);
            }
        }