Пример #1
0
        protected void lnkPrintGradingCode_Click(object sender, EventArgs e)
        {
            DataTable dt  = new DataTable();
            DataTable dt1 = new DataTable();
            DataTable dt2 = new DataTable();

            dt = GradingModel.GetSampleDate(Session["SampleCode"].ToString());
            List <GradingModel> samplingList = GradingModel.getSamplingInfo(Session["SampleCode"].ToString());

            dt1 = GradingModel.GetWoredaName(samplingList[0].WoredaID);
            dt2 = GradingModel.GetCommodityClass(samplingList[0].CommodityID, samplingList[0].WoredaID, null, samplingList[0].VoucherCommodityTypeID);

            Session["VoucherCommodityTypeID"] = samplingList[0].VoucherCommodityTypeID;
            Session["CommodityID"]            = samplingList[0].CommodityID;
            Session["GenerateCode"]           = Session["GradingsId_Search"];
            Session["ReportType"]             = "GradingCode";
            ScriptManager.RegisterStartupScript(UpdatePanel1,
                                                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);
        }
Пример #2
0
 private void FillCommodityClass(DropDownList ddl, Guid?CommodityId, Guid?WeradaId, Guid?FactorGroupId)
 {
     if (Guid.Empty == WeradaId)
     {
         WeradaId = null;
     }
     ddl.DataSource = null;
     ddl.Items.Clear();
     ddl.Items.Add("");
     ddl.DataSource     = GradingModel.GetCommodityClass(CommodityId, WeradaId, FactorGroupId);
     ddl.DataTextField  = "Class";
     ddl.DataValueField = "ClassID";
     ddl.DataBind();
 }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            {
                Session.Remove("gModel");

                if (Request.QueryString["sampleCode"] == null)
                {
                    Messages.SetMessage("An error has occurred Please log out and Try Agian.", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }
                ViewState["sampleCode"] = Request.QueryString["sampleCode"];
                SamplingCode            = Request.QueryString["sampleCode"];
                if (string.IsNullOrEmpty(SamplingCode))
                {
                    Messages.SetMessage("An error has occurred Please log out and Try Agian.", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }
                lblSampleCodeValue.Text = SamplingCode;
                DataTable dt  = new DataTable();
                DataTable dt1 = new DataTable();
                DataTable dt2 = new DataTable();
                dt = GradingModel.GetSampleDate(SamplingCode);
                List <GradingModel> samplingList = GradingModel.getSamplingInfo(SamplingCode);
                dt1 = GradingModel.GetWoredaName(samplingList[0].WoredaID);
                dt2 = GradingModel.GetCommodityClass(samplingList[0].CommodityID, samplingList[0].WoredaID, null, samplingList[0].VoucherCommodityTypeID);
                pnlGradingClass.Visible           = false;
                Session["VoucherCommodityTypeID"] = samplingList[0].VoucherCommodityTypeID;
                Session["CommodityID"]            = samplingList[0].CommodityID;
                if (samplingList[0].CommodityID == new Guid(ConfigurationManager.AppSettings["CoffeeId"].ToUpper().Trim()))
                {
                    pnlGradingClass.Visible = true;
                    if (samplingList[0].VoucherCommodityTypeID == new Guid(ConfigurationManager.AppSettings["illegalCoffee"].ToUpper().Trim()) ||
                        samplingList[0].VoucherCommodityTypeID == new Guid("30d25321-5037-48e1-be0f-5b66ce0330eb")

                        )
                    {
                        if (samplingList[0].VoucherCommodityTypeID == new Guid("30d25321-5037-48e1-be0f-5b66ce0330eb"))
                        {
                            lblClassValue.Text = "Bi-Product Coffee";
                        }
                        else
                        {
                            lblClassValue.Text = "Illegal Coffee";
                        }
                    }
                    else if (dt2.Rows.Count > 0)
                    {
                        for (int i = dt2.Rows.Count; i > 0; i--)
                        {
                            if (!dt2.Rows[i - 1]["Class"].ToString().EndsWith("Q"))
                            {
                                if (i == dt2.Rows.Count)
                                {
                                    lblClassValue.Text = dt2.Rows[i - 1]["Class"].ToString();
                                }
                                else if (lblClassValue.Text == string.Empty)
                                {
                                    lblClassValue.Text = dt2.Rows[i - 1]["Class"].ToString();
                                }
                                else
                                {
                                    lblClassValue.Text = lblClassValue.Text + " ; " + dt2.Rows[i - 1]["Class"].ToString();
                                }
                            }
                        }
                    }
                    else
                    {
                        Messages.SetMessage("Class must be assigned to generate a code.", WarehouseApplication.Messages.MessageType.Error);
                        btnAdd.Visible          = false;
                        btnGenerateCode.Visible = false;
                    }
                }
                if (dt1.Rows.Count > 0)
                {
                    lblWoredaValue.Text = dt1.Rows[0]["Description"].ToString();
                }
                //else
                //  Messages.SetMessage("There is no Woreda with this parameter.", WarehouseApplication.Messages.MessageType.Error);
                if (dt.Rows.Count > 0)
                {
                    lblSampleDateValue.Text = dt.Rows[0]["SampleCodeGeneratedTimeStamp"].ToString();
                }
                else
                {
                    Messages.SetMessage("Please provide Sample Date.", WarehouseApplication.Messages.MessageType.Error);
                }
                FillDrop(drpGrader, WareHouseOperatorTypeEnum.Grader);
            }
        }
Пример #4
0
        private void onCommodityFactorGroupChange(bool?ForUpdate, string GclassValue)
        {
            Messages1.ClearMessage();
            gvGradingFactors1.DataSource = new DataTable();
            gvGradingFactors1.DataBind();
            drpGrade.Items.Clear();
            drpGrade.DataSource = new DataTable();
            drpGrade.DataBind();
            if (drpCommodityFactorGroup.SelectedIndex > 0)
            {
                bool woradaknown = !(WeradaID == null || Guid.Empty == WeradaID || CommodityTypeID == illegalCommodityTypeID);

                int gradingResultStatus = ((Dictionary <string, int>)ViewState["FGs"])[drpCommodityFactorGroup.SelectedValue];

                if ((int)GradingResultStatus.AcceptableResult != gradingResultStatus)
                {
                    drpGrade.Enabled                = false;
                    rfvdrpGrade.Enabled             = false;
                    drpProductionYear.Enabled       = false;
                    rfvdrpProductionYear.Enabled    = false;
                    drpCommodityClass.SelectedIndex = -1;
                    rfvdrpCommodityClass.Enabled    = false;
                    //drpCommodityClass.Enabled = false;
                }
                else
                {
                    drpGrade.Enabled             = true;
                    rfvdrpGrade.Enabled          = true;
                    rfvdrpProductionYear.Enabled = true;
                    drpProductionYear.Enabled    = true;
                    if (CommodityID == new Guid("37d28859-5579-436b-98c8-2bf28bd413be"))
                    {
                        woradaknown = false;
                    }
                    if (woradaknown)
                    {
                        //FillCommodityClass(drpCommodityClass, null,
                        //     WeradaID,
                        //     new Guid(drpCommodityFactorGroup.SelectedValue));
                        //if (((DataTable)drpCommodityClass.DataSource).Rows.Count > 0)
                        //    drpCommodityClass.SelectedIndex = 1;
                        if (!chkChangeClass.Checked)
                        {
                            //if (IsNonCoffee != null && IsNonCoffee.Value)
                            DataTable dt = GradingModel.GetCommodityClass(null, WeradaID, new Guid(drpCommodityFactorGroup.SelectedValue));
                            if (GclassValue == null || dt.Select("ClassID ='" + GclassValue + "'").Count() > 0)
                            {
                                FillCommodityClass(drpCommodityClass, null, WeradaID, new Guid(drpCommodityFactorGroup.SelectedValue));
                            }
                            if (dt.Rows.Count > 0)
                            {
                                //if (drpCommodityClass.Items.Count == 2)// || (IsNonCoffee == null || !IsNonCoffee.Value))//
                                if (dt.Rows.Count == 1)// || (IsNonCoffee == null || !IsNonCoffee.Value))
                                {
                                    if (GclassValue == null)
                                    {
                                        //DataTable dt = GradingModel.GetCommodityClass(null, WeradaID, new Guid(drpCommodityFactorGroup.SelectedValue));
                                        drpCommodityClass.SelectedValue = dt.Rows[0]["ClassID"].ToString();
                                    }
                                    else
                                    {
                                        drpCommodityClass.SelectedValue = GclassValue;
                                    }
                                    drpCommodityClass.Enabled    = false;
                                    rfvdrpCommodityClass.Enabled = false;
                                }
                                else
                                {
                                    if (ForUpdate == null || !ForUpdate.Value)
                                    {
                                        drpCommodityClass.SelectedIndex = 0;
                                    }
                                    else if (GclassValue != null)
                                    {
                                        drpCommodityClass.SelectedValue = GclassValue;
                                    }
                                    drpCommodityClass.Enabled    = true;
                                    rfvdrpCommodityClass.Enabled = true;
                                }
                            }
                            else
                            {
                                Messages1.SetMessage("Class with the factor group and woreda was not found");
                            }
                        }
                    }
                    if (drpCommodityClass.SelectedIndex > 0)
                    {
                        FillCommodityGrade(drpGrade, new Guid(drpCommodityFactorGroup.SelectedValue),
                                           new Guid(drpCommodityClass.SelectedValue));
                    }
                }
                FillCommodityFactor(new Guid(drpCommodityFactorGroup.SelectedValue));
            }
        }