void FillCommoditySymbolGrid(GridView gv, Guid CommodityID) { bool forGrade = false; Guid?WoredaID = null; if (rbCommodityClassGrade.SelectedValue != "1") { forGrade = true; } else { if (drpSrhWoreda.SelectedIndex > 0) { WoredaID = new Guid(drpSrhWoreda.SelectedValue); } } gv.DataSource = ModelCommoditySymbol.GetCommoditySymbol(CommodityID, txtSymbol.Text.Trim(), /*(cboCommodityClassForSrh.SelectedIndex < 0 || !forGrade ? "" : cboCommodityClassForSrh.SelectedItem.Text)*/ txtClassSymbol.Text.Trim(), txtGrade.Text.Trim(), forGrade, chkShowInActive.Checked, WoredaID); if (ViewState["PageIndex"] != null) { gv.PageIndex = int.Parse(ViewState["PageIndex"].ToString()); } gv.DataBind(); gv.SelectedIndex = -1; }
void FillCommodityClass(Guid CommodityID) { cboCommodityClass.Items.Clear(); cboCommodityClass.Items.Add(new ListItem("-Select Grading Class-", "")); cboCommodityClass.DataSource = ModelCommoditySymbol.GetCommodityClassByCommodity(CommodityID); cboCommodityClass.DataTextField = "Class"; cboCommodityClass.DataValueField = "ClassID"; cboCommodityClass.DataBind(); }
void FillWoreda(Guid CommodityID) { //Predicate<LookupValue> p = new Predicate<LookupValue>(l => l.CommodityID == CommodityID); //BindCombo(cboWoreda, LookupTypeEnum.Woredas, p, "Select Woreda"); cboWoreda.DataSource = ModelCommoditySymbol.GetWoreda(CommodityID); cboWoreda.DataTextField = "Description"; cboWoreda.DataValueField = "ID"; cboWoreda.DataBind(); }
void FillGradingFactorGroup(Guid CommodityID) { cboFactorGroup.Items.Clear(); cboFactorGroup.Items.Add(new ListItem("-Select Factor Group-", "")); cboFactorGroup.DataSource = ModelCommoditySymbol.GetFactorGroupForCommodity(CommodityID); cboFactorGroup.DataTextField = "Name"; cboFactorGroup.DataValueField = "ID"; cboFactorGroup.DataBind(); }
void FillCommodityType() { drpCommodityType.Items.Clear(); drpCommodityType.Items.Add(new ListItem("-Select Commodity Type-", "")); DataTable dt = ModelCommoditySymbol.GetAllCommodityTypeForClassMap(); drpCommodityType.DataSource = dt; drpCommodityType.DataTextField = "ProcessingGroup"; drpCommodityType.DataValueField = "ProcessingGroup"; drpCommodityType.DataBind(); }
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); }
void FillWoredaGrid(Guid CommodityClassID) { DataTable dt = ModelCommoditySymbol.GetWoredaForClass(CommodityClassID); List <woreda> classWoreda = new List <woreda>(); foreach (DataRow dr in dt.Rows) { woreda w = new woreda(); w.WoredaID = dr["WoredaID"].ToString(); w.WoredaName = dr["WoredaName"].ToString(); classWoreda.Add(w); } ViewState.Add("ClassWoreda", classWoreda); gvClassWereda.DataSource = classWoreda; gvClassWereda.DataBind(); }
void FillCommodityClassifications(Guid CommodityID) { //chkList.Items.Clear(); //chkList.Items.Add(new ListItem("Is Under Screen", "5")); //chkList.Items.Add(new ListItem("Is Semi-Washed", "3")); DataTable dt = ModelCommoditySymbol.GetCommodityClassification(CommodityID); if (dt != null && dt.Rows.Count > 0 && bool.Parse(dt.Rows[0]["Optional"].ToString())) { rbList.Items.Clear(); chkList.DataSource = dt; chkList.DataTextField = "Name"; chkList.DataValueField = "Value"; chkList.DataBind(); } else if (dt != null && dt.Rows.Count > 0) { chkList.Items.Clear(); rbList.DataSource = dt; rbList.DataTextField = "Name"; rbList.DataValueField = "Value"; rbList.DataBind(); } }
void SetValues(ModelCommoditySymbol mcs) { if (rbCommodityClassGrade.SelectedValue == "1") { GridViewRow gvr = gvCommodityClassGrade.SelectedRow; Label lbl = null; lbl = (Label)gvr.FindControl("lblID"); mcs.ID = new Guid(lbl.Text); mcs.GradingFactorGroupID = new Guid(cboFactorGroup.SelectedValue); mcs.Grade = "0"; mcs.InActive = chkInActiveClass.Checked; if (drpCommodityType.SelectedIndex >= 0) { mcs.CommodityGroupI = drpCommodityType.SelectedValue; } if (ViewState["ClassWoreda"] != null) { List <woreda> classWoreda = (List <woreda>)ViewState["ClassWoreda"]; foreach (woreda w in classWoreda) { mcs.addWoreda(w); } } } else { GridViewRow gvr = gvCommodityGrade.SelectedRow; Label lbl = null; lbl = (Label)gvr.FindControl("lblID"); mcs.ID = new Guid(lbl.Text); mcs.GradingFactorGroupID = null; mcs.ParentID = new Guid(cboCommodityClass.Text); mcs.InActive = chkInActiveGrade.Checked; int tempNo = 0; int.TryParse(txtMaxTotalValue.Text, out tempNo); mcs.MaximumTotalValue = tempNo; int.TryParse(txtMinTotalValue.Text, out tempNo); mcs.MinimumTotalValue = tempNo; mcs.Grade = txtGradeValue.Text.Trim(); tempNo = 1; int classification = 1; lbl = (Label)gvr.FindControl("lblClassificationNo"); int.TryParse(lbl.Text, out classification); if (classification == 0) { classification = 1; } if (chkList.Items.Count > 0) { foreach (ListItem li in chkList.Items) { if (li.Selected) { if (classification % int.Parse(li.Value) != 0) { classification *= int.Parse(li.Value); } } else if (classification % int.Parse(li.Value) == 0) { classification /= int.Parse(li.Value); } } } else if (rbList.Items.Count > 0) { classification = int.Parse(rbList.SelectedValue); } if (classification > 1) { mcs.Classification = classification; } else { mcs.Classification = null; } mcs.woredaIdList = null; } }