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."; } } } }
protected void gvUnloading_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { UnloadingBLL obj = (UnloadingBLL)e.Row.DataItem; Label lblCG = (Label)e.Row.Cells[2].FindControl("lblCommodityGrade"); lblCG.Text = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId); } }
public CascadingDropDownNameValue[] GetCommodities(string knownCategoryValues, string category) { List <CascadingDropDownNameValue> l = new List <CascadingDropDownNameValue>(); List <CommodityGradeBLL> list = CommodityGradeBLL.GetAllCommodity(); foreach (CommodityGradeBLL commodity in list) { l.Add(new CascadingDropDownNameValue(commodity.Commodity.ToString(), commodity.CommodityId.ToString())); } return(l.ToArray()); }
public CascadingDropDownNameValue[] GetCommoditiesContext(string knownCategoryValues, string category, string contextKey) { List <CascadingDropDownNameValue> l = new List <CascadingDropDownNameValue>(); List <CommodityGradeBLL> list = CommodityGradeBLL.GetAllCommodity(); foreach (CommodityGradeBLL commodity in list) { if (commodity.CommodityId.ToString().Trim().ToUpper() == contextKey.Trim().ToUpper()) { l.Add(new CascadingDropDownNameValue(commodity.Commodity.ToString(), commodity.CommodityId.ToString())); } } return(l.ToArray()); }
private void LoadGrading(Guid GradingId) { GradingResultBLL objGrade = new GradingResultBLL(); objGrade = objGrade.GetApprovedGradingResultByGradingId(GradingId); if (objGrade != null) { this.hfCommodityGradeId.Value = objGrade.ID.ToString(); this.hfGradingId.Value = objGrade.GradingId.ToString(); this.lblCode.Text = objGrade.GradingCode.ToString(); this.lblCommodityGrade.Text = CommodityGradeBLL.GetCommodityGradeNameById(objGrade.CommodityGradeId); this.lblProductionYear.Text = objGrade.ProductionYear.ToString(); } }
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; } } } }
private void LoadData(Guid Id) { Guid GradingId = Guid.Empty; GradingDisputeBLL obj = new GradingDisputeBLL(); hfId.Value = Id.ToString(); obj = obj.GetById(Id); ViewState["OldGradingDisputeBLL"] = obj; if (obj != null) { if (obj.GradingId != null) { GradingId = obj.GradingId; GradingBLL objgrading = new GradingBLL(); objgrading = objgrading.GetById(GradingId); this.lblGradeCode.Text = objgrading.GradingCode.ToString(); } if (obj.TrackingNo != null) { this.hfTrackingNo.Value = obj.TrackingNo; } if (obj.DateTimeRecived != null) { this.txtDateRecived.Text = obj.DateTimeRecived.ToShortDateString(); this.txtTimeRecived.Text = obj.DateTimeRecived.ToLongTimeString(); } this.cboStatus.SelectedValue = obj.Status.ToString(); if (obj.Remark != null) { this.txtRemark.Text = obj.Remark; } if (obj.PreviousCommodityGradeId != null) { this.lblPreviousGrade.Text = CommodityGradeBLL.GetCommodityGradeNameById(obj.PreviousCommodityGradeId); } if (obj.ExpectedCommodityGradeId != null) { CommodityGradeBLL objCG = CommodityGradeBLL.GetCommodityGrade(obj.ExpectedCommodityGradeId); CommodityGradeBLL objCC = CommodityGradeBLL.GetCommodityClassById(objCG.CommodityClassId); CommodityGradeBLL objC = CommodityGradeBLL.GetCommodityById(objCC.CommodityId); this.cboCommodity_CascadingDropDown.SelectedValue = objC.CommodityId.ToString(); this.cboCommodityClass_CascadingDropDown.SelectedValue = objCC.CommodityClassId.ToString(); this.cboCommodityGrade_CascadingDropDown.SelectedValue = obj.ExpectedCommodityGradeId.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack != true) { CommodityGradeBLL objGrade = new CommodityGradeBLL(); List <CommodityGradeBLL> list = CommodityGradeBLL.GetAllCommodity(); this.cboCommodity.Items.Add(new ListItem("Please Select Commodity", "")); if (list != null) { foreach (CommodityGradeBLL i in list) { this.cboCommodity.Items.Add(new ListItem(i.Commodity, i.CommodityId.ToString())); } } dsResult = new DataSet(); } }
private void LoadCommodityControls(Guid GradeId) { if (GradeId == Guid.Empty) { this.chkRecivedGrade.Checked = false; } else { this.chkRecivedGrade.Checked = true; //get Commodity Grade CommodityGradeBLL objGrade = new CommodityGradeBLL(); objGrade = CommodityGradeBLL.GetCommodityGrade(GradeId); //get CommodityClass CommodityGradeBLL objClass = CommodityGradeBLL.GetCommodityClassById(objGrade.CommodityClassId); this.cboCommodityGrade_CascadingDropDown.SelectedValue = GradeId.ToString(); this.cboCommodityClass_CascadingDropDown.SelectedValue = objGrade.CommodityClassId.ToString(); this.cboCommodity_CascadingDropDown.SelectedValue = objClass.CommodityId.ToString(); ViewState["OldCommodityGrade"] = GradeId.ToString(); } }
public CascadingDropDownNameValue[] GetCommodityClass(string knownCategoryValues, string category) { string ID = ""; StringDictionary kv; kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); if (!kv.ContainsKey("Commodity") || kv["Commodity"].ToString() == "") { throw new ArgumentException("Couldn't find selected Commodity."); } ID = kv["Commodity"]; List <CascadingDropDownNameValue> l = new List <CascadingDropDownNameValue>(); List <CommodityGradeBLL> list = CommodityGradeBLL.GetCommodityClassByCommodityId(new Guid(ID)); foreach (CommodityGradeBLL commodityClass in list) { l.Add(new CascadingDropDownNameValue(commodityClass.ClassName.ToString(), commodityClass.CommodityClassId.ToString())); } return(l.ToArray()); }
private void loadGradingInfo() { //Displaay the commodity Grade. GradingResultBLL objGR = new GradingResultBLL(); objGR = objGR.GetGradingResultById(new Guid(this.hfGradingResultId.Value.ToString())); if (objGR != null) { CommodityGradeBLL oCG = CommodityGradeBLL.GetCommodityGrade(objGR.CommodityGradeId); ViewState["CommId"] = oCG.CommodityId.ToString(); this.lblCG.Text = oCG.GradeName; if (oCG.CommodityId == (Guid)Utility.GetCommodityId("Coffee")) { this.lblUnit.Text = "(KG)"; this.lblUnit1.Text = "(KG)"; } else { this.lblUnit.Text = "(Qtls)"; this.lblUnit1.Text = "(Qtls)"; } } }
private void LoadDataAfterChange() { Guid Id; try { Id = new Guid(this.cboGradingCode.SelectedValue.ToString()); } catch { this.lblMsg.Text = "Please select Grading code"; return; } // get previous Grading. GradingResultBLL obj = new GradingResultBLL(); obj = obj.GetClientRejectedGradingResultByGradingId(Id); if (obj != null) { this.hfGradingResultId.Value = obj.ID.ToString(); this.hfPreviousGradingResult.Value = obj.CommodityGradeId.ToString(); this.lblPreviousGrade.Text = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId); } }
private void GradingResultReport_ReportStart(object sender, EventArgs e) { if (HttpContext.Current.Session["rptGradingResultId"] == null) { throw new Exception("Session expired"); } else { Guid Id = Guid.Empty; Id = new Guid(HttpContext.Current.Session["rptGradingResultId"].ToString()); GradingResultBLL obj = new GradingResultBLL(); obj = obj.GetGradingResultById(Id); if (obj == null) { throw new Exception("Object Null"); } else { txtTrackingNo.Text = obj.TrackingNo; txtResultDate.Text = obj.GradeRecivedTimeStamp.ToString("dd MMM-yyyy"); txtCode.Text = obj.GradingCode.ToString(); if (obj.Status != GradingResultStatus.GeneralRequiementfail && obj.Status != GradingResultStatus.MoistureFailed) { txtGradeReceived.Text = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId); } else if (obj.Status == GradingResultStatus.MoistureFailed) { txtGradeReceived.Text = "Moisture Failed"; } else if (obj.Status == GradingResultStatus.GeneralRequiementfail) { txtGradeReceived.Text = "General Requiement Fail"; } } } }
protected void btnSave_Click(object sender, EventArgs e) { this.lblMsg2.Text = ""; this.lblmsg.Text = ""; List <StackUnloadedBLL> listtoBeUpdated = null; List <StackUnloadedBLL> listOriginal = null; if (ViewState["vwStackUnloaded"] == null) { this.lblmsg.Text = "An error has occured please try again.If the error persists contact the administrators"; return; } else { listtoBeUpdated = (List <StackUnloadedBLL>)ViewState["vwStackUnloaded"]; } if (ViewState["vwStackUnloadedOriginal"] == null) { this.lblmsg.Text = "An error has occured please try again.If the error persists contact the administrators"; return; } else { listOriginal = (List <StackUnloadedBLL>)ViewState["vwStackUnloadedOriginal"]; } float remainder; int lotsizeInBags = 0; Guid CommGradeId = new Guid(ViewState["UnloadingCommGradeId"].ToString()); lotsizeInBags = CommodityGradeBLL.GetCommodityGradeLotSizeInBagsById(CommGradeId); UnloadingBLL obj = new UnloadingBLL(); try { obj.Id = new Guid(this.hfUnloadingId.Value.ToString()); } catch { this.lblmsg.Text = "Unable to update this record please try agian"; return; } Nullable <int> totbag = null; if (DataValidationBLL.isInteger(this.txtNumberOfBags.Text, out totbag) == true) { obj.TotalNumberOfBags = (int)totbag; } else { this.lblmsg.Text = "Please Enter Number of bags."; this.txtNumberOfBags.Focus(); return; } //checking that the Number of Bags aree within ecx lot defn. remainder = ((int)totbag) % lotsizeInBags; int SamplerNoBags = -1; int.TryParse(ViewState["SamplingNoBags"].ToString(), out SamplerNoBags); if (SamplerNoBags != -1) { if (((int)totbag) != SamplerNoBags) { //Check string str = " The number of bags counted by the sampler is " + SamplerNoBags.ToString() + " which is different from what you entered. Are you sure you want to save this record?"; lblModalMsg.Text = str; //TODO: Remove Comment //ModalPopupExtender1.Show(); } } //TODO: Remove //ModalPopupExtender mdl = new ModalPopupExtender(); //mdl = ModalPopupExtender1; remainder = ((int)totbag) % lotsizeInBags; if (((int)remainder) != 0) { lblModalMsg.Text = "Per ECX rule, the number of bags entered is not acceptable. Do you still want to save?"; //TODO: Remove Comment //ModalPopupExtender1.Show(); } int totBagCount = 0; if (ViewState["totBagCount"] != null) { if ((int.TryParse(ViewState["totBagCount"].ToString(), out totBagCount)) != true) { this.lblmsg.Text = "Unable to get the total sum of the bags in each stack unloaded.Please return to the search page and try again."; return; } } if (totBagCount != (int)totbag) { this.lblmsg.Text = "The Total Number of bags doesn't match the sum of bags unloaded in each stack."; return; } Nullable <DateTime> depositeddate = null; if (DataValidationBLL.isDate(this.txtDateDeposited.Text, out depositeddate) == true) { obj.DateDeposited = (DateTime)depositeddate; } else { this.lblmsg.Text = "Please select date deposited."; this.txtDateDeposited.Focus(); return; } Nullable <Int32> status = null; if (DataValidationBLL.isInteger(this.cboStatus.SelectedValue.ToString(), out status) == true) { obj.Status = (UnloadingStatus)(Int32)status; } else { this.lblmsg.Text = "Please select Status."; this.cboStatus.Focus(); return; } try { if (ViewState["vwStackUnloaded"] == null) { this.lblmsg.Text = "An error has occured please try agian.If the error persists contact the administrator"; return; } if (obj.Update(listtoBeUpdated, listOriginal) == true) { this.lblmsg.Text = "Data updated Successfully."; } else { this.lblmsg.Text = "Unable to update data please try again."; } } catch (Exception ex) { throw ex; } }
private void BindUnloading() { try { Guid UnloadingId = new Guid(Request.QueryString["Id"].ToString()); this.hfUnloadingId.Value = UnloadingId.ToString(); UnloadingBLL obj = new UnloadingBLL(); CommodityGradeBLL objCommodityGrade = new CommodityGradeBLL(); obj.Id = UnloadingId; obj = obj.GetById(); if (obj != null) { this.lblGradingCode.Text = obj.GradingCode.ToString(); string CommodityGradeName = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId); this.lblCommodityGrade.Text = CommodityGradeName; this.txtNumberOfBags.Text = obj.TotalNumberOfBags.ToString(); this.txtDateDeposited.Text = obj.DateDeposited.ToShortDateString(); this.cboStatus.SelectedValue = ((int)obj.Status).ToString(); ViewState["UnloadingCommGradeId"] = obj.CommodityGradeId; ViewState["totBagCount"] = obj.TotalNumberOfBags.ToString(); // Get Grading Id GradingResultBLL objGradingResult = new GradingResultBLL(); objGradingResult = objGradingResult.GetGradingResultById(obj.GradingResultId); if (objGradingResult != null) { GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById(objGradingResult.GradingId); if (objGrading != null) { SamplingResultBLL objSamplingResult = new SamplingResultBLL(); objSamplingResult = objSamplingResult.GetSamplingResultById(objGrading.SamplingResultId); if (objSamplingResult != null) { ViewState["SamplingNoBags"] = objSamplingResult.NumberOfBags; } else { this.lblmsg.Text = "An error has occured please try again.If the error persists contact the administrator"; return; } } else { this.lblmsg.Text = "An error has occured please try agin.If the error persists contact the administrator"; return; } } } //TODO :Remove the ff // this.cboStackNo.Items.Add(new ListItem("Stack No 1", "eaf7ebcc-f39a-4c7d-b855-1e5d5578dbcb")); //TODO Remove Comment Guid warehouseId = UserBLL.GetCurrentWarehouse(); // Loading shedby warehouse. ShedBLL shed = new ShedBLL(); List <ShedBLL> shedlist = new List <ShedBLL>(); shedlist = shed.GetActiveShedByWarehouseId(warehouseId); cboShed.Items.Add(new ListItem("Please select Shed", "")); if (shedlist.Count > 0) { foreach (ShedBLL o in shedlist) { cboShed.Items.Add(new ListItem(o.ShedNumber, o.Id.ToString())); } } else { this.btnAdd.Enabled = false; } GRNBLL objGRN = new GRNBLL(); string strE = " UnLoadingId='" + UnloadingId.ToString() + "' "; if (objGRN.IsEditableGRN(strE) == false) { this.btnAdd.Enabled = false; this.btnSave.Enabled = false; this.lblmsg.Text = "You can't edit this information as GRN has already been created using this Unloading Information."; } } catch (Exception ex) { throw ex; } }
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(); } }
protected void btnSave_Click(object sender, EventArgs e) { // Get the one lotsize. if (ViewState["UnloadingCommGradeId"] == null) { this.lblmsg.Text = "An error has occured please try again, if the error persists contact the administrator"; return; } int lotsizeInBags = 0; Guid CommGradeId = new Guid(ViewState["UnloadingCommGradeId"].ToString()); lotsizeInBags = CommodityGradeBLL.GetCommodityGradeLotSizeInBagsById(CommGradeId); if (lotsizeInBags == 0) { this.lblmsg.Text = "Unbale to get lot size in bags."; return; } Nullable <int> totalnumberofBags = null; totalnumberofBags = int.Parse(this.txtNumberOfBags.Text); int remainder; this.lblMsg2.Text = ""; this.lblmsg.Text = ""; Nullable <Guid> gradingresultid = null; if (DataValidationBLL.isGUID(this.cboGradingCode.SelectedValue.ToString(), out gradingresultid) == false) { this.lblmsg.Text = "please select Grading Code."; return; } DateTime depositedate; if ((DateTime.TryParse((this.txtDateDeposited.Text) + " " + this.txtTimeDeposited.Text, out depositedate)) == false) { this.lblmsg.Text = "Invalid Date Deposited."; return; } if (string.IsNullOrEmpty(hfTrackingNo.Value) == true) { this.lblmsg.Text = "Unable to get tracking No Please try again."; return; } Guid BagTypeId = Guid.Empty; if (string.IsNullOrEmpty(this.cboBagType.SelectedValue.ToString()) == true) { this.lblmsg.Text = "Unable to get Bag Type No Please try again."; return; } else { try { BagTypeId = new Guid(this.cboBagType.SelectedValue.ToString()); } catch { this.lblmsg.Text = "Unable to get Bag Type No Please try again."; return; } } // UnloadingBLL obj = new UnloadingBLL(); obj.GradingResultId = (Guid)gradingresultid; obj.TotalNumberOfBags = (int)totalnumberofBags; obj.DateDeposited = (DateTime)depositedate; obj.CreatedBy = UserBLL.GetCurrentUser(); obj.ReceivigRequestId = new Guid(this.hfRecivingRequestId.Value.ToString()); obj.TrackingNo = hfTrackingNo.Value; obj.BagTypeId = BagTypeId; List <StackUnloadedBLL> list = new List <StackUnloadedBLL>(); list = (List <StackUnloadedBLL>)ViewState["StackUnloaded"]; int totCount = 0; if (list != null) { foreach (StackUnloadedBLL i in list) { totCount = totCount + i.NumberOfbags; } } if (totCount != totalnumberofBags) { this.lblmsg.Text = "Please Check Total Number of bags against Bags Unloaded in each stack"; bindGrid(); return; } int SamplerNoBags = -1;; if (ViewState["SamplingNoBags"] != null) { SamplerNoBags = int.Parse(ViewState["SamplingNoBags"].ToString()); } if (SamplerNoBags != -1) { if (((int)totalnumberofBags) != SamplerNoBags) { //Check string str = " The number of bags counted by the sampler is " + SamplerNoBags.ToString() + " which is different from what you entered. Are you sure you want to save this record?"; txtReason.InnerText = str; ModalPopupExtender1.Show(); } } ModalPopupExtender mdl = new ModalPopupExtender(); mdl = ModalPopupExtender1; remainder = ((int)totalnumberofBags) % lotsizeInBags; if (((int)remainder) != 0) { txtReason.InnerText = "Per ECX rule, the number of bags entered is not acceptable. Do you still want to save?"; ModalPopupExtender1.Show(); } if (obj.Add(list) == true) { this.lblmsg.Text = "Data Successfully Updated"; Response.Redirect("ListInbox.aspx"); } else { this.lblmsg.Text = "Data can't be added.Please try again."; } }
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; }
private void selectedGradechanged(Guid Id) { GradingResultBLL obj = new GradingResultBLL(); obj = obj.GetGradingResultById(Id); this.cboGradingCode.Items.Add(new ListItem(obj.GradingCode.ToString(), obj.GradingCode.ToString())); this.cboGradingCode.SelectedValue = obj.GradingCode.ToString(); this. hfTrackingNo.Value = obj.TrackingNo; if (obj != null) { this.hfRecivingRequestId.Value = obj.CommodityDepositRequestId.ToString(); CommodityGradeBLL objCG = new CommodityGradeBLL(); string CGName; CGName = CommodityGradeBLL.GetCommodityGradeNameById(obj.CommodityGradeId); ViewState["UnloadingCommGradeId"] = obj.CommodityGradeId; this.lblCommodityGrade.Text = CGName; lblCADateTime.Text = ((DateTime)obj.ClientAcceptanceTimeStamp).ToShortDateString(); //try //{ // cmpSampGen.ValueToCompare = ((DateTime)obj.ClientAcceptanceTimeStamp).ToShortDateString(); //} //catch //{ // cmpSampGen.ValueToCompare = ((DateTime.Now).AddDays(-100)).ToShortDateString(); //} // Get Grading Id GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById(obj.GradingId); if (objGrading != null) { SamplingResultBLL objSamplingResult = new SamplingResultBLL(); objSamplingResult = objSamplingResult.GetSamplingResultById(objGrading.SamplingResultId); if (objSamplingResult != null) { ViewState["SamplingNoBags"] = objSamplingResult.NumberOfBags; } else { this.lblmsg.Text = "An error has occured please try agin.If the error persists contact the administrator"; return; } } else { this.lblmsg.Text = "An error has occured please try agin.If the error persists contact the administrator"; return; } } else { this.lblmsg.Text = "please select grading code and try again."; return; } //Load Commodity Grade Bags List <BagTypeBLL> list = new List <BagTypeBLL>(); BagTypeBLL objBagType = new BagTypeBLL(); list = objBagType.GetCommodityGradeBag(obj.CommodityGradeId); this.cboBagType.Items.Clear(); if (list != null) { if (list.Count > 0) { this.cboBagType.Items.Add(new ListItem("Please Select Bag Type", "")); foreach (BagTypeBLL i in list) { this.cboBagType.Items.Add(new ListItem(i.BagTypeName, i.Id.ToString())); } } } }
protected void btnSave_Click(object sender, EventArgs e) { bool isSaved = false; Nullable <Guid> CommodityGradeId = null; Nullable <Guid> ShedId = null; StackStatus Status; Nullable <DateTime> DateStarted = null; string StackNumer; try { CommodityGradeId = new Guid(this.cboCommodityGrade.SelectedValue.ToString()); } catch { this.lblmsg.Text = "Please select Commodity Grade"; return; } try { ShedId = new Guid(this.cboShed.SelectedValue.ToString()); } catch { this.lblmsg.Text = "Please select shed"; return; } StackNumer = this.txtStackNumber.Text; try { Status = (StackStatus)int.Parse(this.cboStatus.SelectedValue.ToString()); } catch { this.lblmsg.Text = "Please select Status"; return; } try { DateStarted = DateTime.Parse(this.txtDateStarted.Text); } catch { this.lblmsg.Text = "Please select Date Started."; return; } CommodityGradeBLL objCG = new CommodityGradeBLL(); objCG = CommodityGradeBLL.GetCommodityGrade((Guid)CommodityGradeId); if (objCG == null) { this.lblmsg.Text = "Unable to get commodity Grade.Please try again"; return; } if (string.IsNullOrEmpty(objCG.Symbol) == true) { this.lblmsg.Text = "Unable to get commodity Grade Symbol.Please try again"; return; } int NoBags, PhysicalAddress; StackBLL objStack = new StackBLL(); objStack.CommodityGradeid = (Guid)CommodityGradeId; objStack.CommodityGradeid = (Guid)CommodityGradeId; objStack.ShedId = (Guid)ShedId; if (int.TryParse(this.txtBeginingNoBags.Text, out NoBags) == false) { this.lblmsg.Text = "Please correct Begining No. Bags. "; return; } if (int.TryParse(this.cboStackNumber.SelectedValue.ToString(), out PhysicalAddress) == false) { this.lblmsg.Text = "Please Select Physical Stack Number. "; return; } string stackName = this.cboStackNumber.SelectedValue + "-" + objCG.Symbol + "-" + this.txtDateStarted.Text; //productionyearstack int productionYear = int.Parse(this.cboProductionYear.SelectedValue.ToString()); objStack.BeginingNoBags = NoBags; objStack.PhysicalAddress = PhysicalAddress; objStack.StackNumber = stackName; objStack.DateStarted = (DateTime)DateStarted; objStack.Status = Status; objStack.WarehouseId = new Guid(this.cboWarehouse.SelectedValue.ToString()); objStack.ProductionYear = productionYear; if (objStack.ValidateForSave() == true) { isSaved = objStack.Add(); if (isSaved == true) { this.lblmsg.Text = "Data updated Successfully"; this.txtStackNumber.Text = stackName; //Clear(); this.btnSave.Enabled = false; } else { this.lblmsg.Text = "Unable to add this record."; } } }
//private CachedDictionary<ECXLookUp.CNIDType> nidTypeLookup = new CachedDictionary<ECXLookUp.CNIDType>( // delegate(ECXLookUp.CNIDType nidType) // { // return nidType.Name; // }, // delegate(object key) // { // return null; // }, // delegate() // { // ECXLookUp.ECXLookup ecxLookup = new WarehouseApplication.ECXLookUp.ECXLookup(); // ECXLookUp.CNIDType[] nidTypes = ecxLookup.GetActiveNIDTypes(BLL.Utility.GetWorkinglanguage()); // List<KeyValuePair<object, WarehouseApplication.ECXLookUp.CNIDType>> kvps = new List<KeyValuePair<object, WarehouseApplication.ECXLookUp.CNIDType>>(); // foreach (ECXLookUp.CNIDType nidType in nidTypes) // { // kvps.Add(new KeyValuePair<object, WarehouseApplication.ECXLookUp.CNIDType>(nidType.Id, nidType)); // } // return kvps; // }); //private Dictionary<object, string> shedLookup = new Dictionary<object,string>(); //private Dictionary<object, string> stackLookup = new Dictionary<object,string>(); //private CachedDictionary<BagTypeBLL> bagTypeLookup = new CachedDictionary<BagTypeBLL>( // delegate(BagTypeBLL bagType) // { // return bagType.BagTypeName; // }, // delegate(object key) // { // return BagTypeBLL.GetBagType((Guid)key); // }, // delegate() // { // List<KeyValuePair<object, BagTypeBLL>> kvps = new List<KeyValuePair<object, BagTypeBLL>>(); // foreach (BagTypeBLL bagType in BagTypeBLL.GetAllBagTypes()) // { // kvps.Add(new KeyValuePair<object, BagTypeBLL>(bagType.Id, bagType)); // } // return kvps; // }); //private WarehouseBLL currentWareHouse = new WarehouseBLL() { // Code = "102", // WarehouseId = new Guid("fa0a52e8-9308-4d5e-b323-88ca5ba232ed") //}; #region ILookupSource Members public IDictionary <object, string> GetLookup(string lookupName) { try { Dictionary <object, string> lookup = new Dictionary <object, string>(); switch (lookupName) { case "CommodityGrade": return(new CachedDictionary <CommodityGradeBLL>( delegate(CommodityGradeBLL commodityGrade) { return commodityGrade.GradeName; }, delegate(object key) { return CommodityGradeBLL.GetCommodityGrade((Guid)key); }, delegate() { List <KeyValuePair <object, CommodityGradeBLL> > kvps = new List <KeyValuePair <object, CommodityGradeBLL> >(); foreach (CommodityGradeBLL commodityGrade in CommodityGradeBLL.GetAllCommodityDetail()) { kvps.Add(new KeyValuePair <object, CommodityGradeBLL>(commodityGrade.CommodityGradeId, commodityGrade)); } return kvps; })); case "Client": return(new CachedDictionary <ClientBLL>( clientLookup, delegate(ClientBLL client) { return client.ClientName; }, delegate(object key) { return ClientBLL.GetClinet((Guid)key); })); case "ClientId": return(new CachedDictionary <ClientBLL>( clientLookup, delegate(ClientBLL client) { return client.ClientId; }, delegate(object key) { return ClientBLL.GetClinet((Guid)key); })); case "Warehouse": return(new CachedDictionary <WarehouseBLL>( warehouseLookup, delegate(WarehouseBLL warehouse) { return warehouse.WarehouseName; }, delegate(object key) { return WarehouseBLL.GetById((Guid)key); })); case "WarehouseManager": return(new CachedDictionary <string>( delegate(string warehouseManager) { return warehouseManager; }, delegate(object key) { //return UserRightBLL.GetUsersWithRight("WHPWM").Find(u => u.UserId == (Guid)key).FullName; return UserRightBLL.GetUserNameByUserId((Guid)key); })); case "NIDType": //ICollection<object> keys = nidTypeLookup.Keys; //return nidTypeLookup; List <NIDTypeBLL> nidTypes = NIDTypeBLL.GetAllNIDTypes(); nidTypes.ForEach(nidType => lookup.Add(nidType.Id, nidType.Name)); break; case "VerifyingClerk": //return GetWorkersLookup("VerifyingClerk"); UserRightBLL.GetUsersWithRight("VerifyingClerk").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "InventoryController": //return GetWorkersLookup("InventoryController"); UserRightBLL.GetUsersWithRight("InventoryController").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "Loader": //return GetWorkersLookup("Loader"); UserRightBLL.GetUsersWithRight("Loader").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "Weigher": //return GetWorkersLookup("Weigher"); UserRightBLL.GetUsersWithRight("Weigher").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "Sampler": //return GetWorkersLookup("Sampler"); UserRightBLL.GetUsersWithRight("Sampler").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "Grader": //return GetWorkersLookup("Grader"); UserRightBLL.GetUsersWithRight("Grader").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "Gatekeeper": //return GetWorkersLookup("Gatekeeper"); UserRightBLL.GetUsersWithRight("Gatekeeper").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "Inspector": //return GetWorkersLookup("Gatekeeper"); UserRightBLL.GetUsersWithRight("WHPCT").ForEach(user => lookup.Add(user.UserId, user.FullName)); break; case "BagType": foreach (BagTypeBLL bagType in BagTypeBLL.GetAllBagTypes()) { lookup.Add(bagType.Id, bagType.BagTypeName); } break; case "BagWeight": foreach (BagTypeBLL bagType in BagTypeBLL.GetAllBagTypes()) { lookup.Add(bagType.Id, bagType.Tare.ToString()); } break; case "CurrentWarehouse": lookup.Add("Id", WarehouseBLL.CurrentWarehouse.WarehouseId.ToString()); lookup.Add("WarehouseCode", WarehouseBLL.CurrentWarehouse.Code); //lookup.Add("WarehouseManagerId", currentWareHouse.WarehouseId.ToString()); //lookup.Add("WarehouseManagerName", ""); break; case "CurrentUser": lookup.Add("Id", UserBLL.GetCurrentUser().ToString()); lookup.Add("Name", UserBLL.GetName(UserBLL.GetCurrentUser())); break; case "WorkerStatus": lookup.Add(0, "Status 1"); lookup.Add(1, "Status 2"); break; case "EmployeeRole": lookup.Add(WorkType.GINGrading, "0e604921-ee27-4406-97ce-846b47b1cd75"); lookup.Add(WorkType.GINLoading, "0e604921-ee27-4406-97ce-846c47b1cd75"); lookup.Add(WorkType.GINSampling, "0e604921-ee27-4406-97ce-84db47b1cd75"); lookup.Add(WorkType.GINScaling, "0e604921-ee27-4406-97ce-846e47b1cd75"); break; case "Shed": foreach (ShedBLL shed in new ShedBLL().GetActiveShedByWarehouseId(WarehouseBLL.CurrentWarehouse.WarehouseId)) { lookup.Add(shed.Id, shed.ShedNumber); } break; case "Stack": foreach (Guid shedId in GetLookup("Shed").Keys) { foreach (StackBLL stack in new StackBLL().GetActiveStackbyShedId(shedId)) { lookup.Add(stack.Id, stack.StackNumber); } } break; case "TruckType": lookup.Add(Guid.Empty, "Not Registred"); TruckTypeBLL objTT = new TruckTypeBLL(); List <TruckTypeBLL> list = objTT.GetActiveTrucksTypes(); list.Sort(TruckTypeComp); list.ForEach(tt => lookup.Add(tt.Id, tt.TruckTypeName)); break; } lookup.OrderBy(lkup => lkup.Value); return(lookup); } catch (Exception ex) { throw new Exception(string.Format("Item not found for the {0} lookup.", lookupName), ex); } }