public static List <GradingBLL> GetGradingsPendingDispute(Guid WarehouseId) { string strSql = "spGetGradingCodesWithClientRejection"; SqlParameter[] arPar = new SqlParameter[1]; SqlDataReader reader; arPar[0] = new SqlParameter("@warehouseId", SqlDbType.UniqueIdentifier); arPar[0].Value = WarehouseId; List <GradingBLL> list; SqlConnection conn = Connection.getConnection(); if (conn == null || conn.State != ConnectionState.Open) { throw new Exception("Invalid database connection."); } reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar); if (reader.HasRows) { list = new List <GradingBLL>(); while (reader.Read()) { GradingBLL obj = new GradingBLL(); obj.Id = new Guid(reader["Id"].ToString()); obj.GradingCode = reader["GradingCode"].ToString(); obj.TrackingNo = reader["TransactionId"].ToString(); list.Add(obj); } return(list); } else { return(null); } }
public static GradingBLL GetGradingById(Guid Id) { string strSql = "spGetGradingbyId"; GradingBLL obj; SqlDataReader reader; SqlConnection conn = new SqlConnection(); SqlParameter[] arPar = new SqlParameter[1]; arPar[0] = new SqlParameter("@GradingId", SqlDbType.UniqueIdentifier); arPar[0].Value = Id; try { conn = Connection.getConnection(); reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar); if (reader.HasRows) { obj = new GradingBLL(); if (reader.Read()) { obj.Id = new Guid(reader["Id"].ToString()); obj.SamplingResultId = new Guid(reader["SamplingResultId"].ToString()); obj.CommodityRecivingId = new Guid(reader["CommodityRecivingId"].ToString()); obj.GradingCode = reader["GradingCode"].ToString(); obj.DateCoded = Convert.ToDateTime(reader["DateCoded"].ToString()); obj.Status = (GradingStatus)Convert.ToInt32(reader["status"]); obj.CreatedBy = new Guid(reader["CreatedBy"].ToString()); obj.CreatedTimestamp = Convert.ToDateTime(reader["CreatedTimestamp"].ToString()); try { obj.LastModifiedBy = new Guid(reader["LastModifiedBy"].ToString()); obj.LastModifiedTimestamp = Convert.ToDateTime(reader["LastModifiedTimestamp"].ToString()); } catch { } obj.TrackingNo = reader["TransactionId"].ToString(); } conn.Close(); return(obj); } else { return(null); } } catch (Exception ex) { throw ex; } finally { if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { this.Page.DataBind(); if (IsPostBack != true) { Nullable <Guid> GRN_number = null; if (Session["GRNID"] != null) { try { //Get Commodity deposite Request Id from the GRN; GRN_number = new Guid(Session["GRNID"].ToString()); if (Session["GRNTrackingNo"] != null) { this.lblCurrentTrackingNo.Text = Session["GRNTrackingNo"].ToString(); } else { GRNBLL objGRN = new GRNBLL(); objGRN = objGRN.GetbyGRN_Number((Guid)GRN_number); if (objGRN != null) { GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById(objGRN.GradingId); this.lblCurrentTrackingNo.Text = objGrading.TrackingNo; } } LoadGRNInformation((Guid)GRN_number); LoadStatus(); Session["GRNID"] = null; Session["GRNTrackingNo"] = null; } catch (Exception ex) { throw ex; } LoadServices(); } this.btnAdd.Attributes.Add("btnGRNService_Click", "ValidateGRNService"); if (Session["msg"] != null) { ECXWF.CMessage mess = (ECXWF.CMessage)Session["msg"]; if (mess.Name == "EditGRN") { this.pnl.Visible = 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(); } } }
private void LoadCommodity() { Guid GradingId = Guid.Empty; try { GradingId = new Guid(this.cboGradingCode.SelectedValue.ToString()); } catch { this.lblMsg.Text = "Please Select Grading Code."; return; } if (GradingId == Guid.Empty) { this.lblMsg.Text = "Please Select Grading Code."; return; } GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById(GradingId); Guid CommodityReciveingRequestId = Guid.Empty; if (objGrading != null) { CommodityReciveingRequestId = objGrading.CommodityRecivingId; } else { this.lblMsg.Text = "An error has occured please Try again."; return; } if (CommodityReciveingRequestId != Guid.Empty) { CommodityDepositeRequestBLL objCommDepReq = new CommodityDepositeRequestBLL(); objCommDepReq = objCommDepReq.GetCommodityDepositeDetailById(CommodityReciveingRequestId); if (objCommDepReq != null) { if (objCommDepReq.CommodityId != null) { this.cboCommodity_CascadingDropDown.ContextKey = objCommDepReq.CommodityId.ToString(); this.cboCommodity_CascadingDropDown.SelectedValue = objCommDepReq.CommodityId.ToString(); this.cboCommodity.SelectedValue = objCommDepReq.CommodityId.ToString(); LoadGradingFactors(objCommDepReq.CommodityId); } } } }
private void LoadCode(Guid SamplingResultId) { List <GradingBLL> list = new List <GradingBLL>(); GradingBLL obj = new GradingBLL(); list = obj.GetGradingBySamplingResultId(SamplingResultId); if (list == null || list.Count < 0) { this.lblMsg.Text = "No codes generated."; } else { this.gvCodeGenerated.DataSource = list; this.gvCodeGenerated.DataBind(); } }
private void BindData() { this.cboGradingCode.Items.Clear(); this.cboGradingCode.Items.Add(new ListItem("Please Select Grading Code.", "")); this.cboGradingCode.AppendDataBoundItems = true; //Get Codes pending results. GradingBLL obj = new GradingBLL(); List <GradingBLL> list = new List <GradingBLL>(); //TODO Warehouse Id Guid warhouseId = UserBLL.GetCurrentWarehouse(); if (Session["GradingRecivedGradingId"] != null) { list = obj.GetGradingsPendingResultByGradingId(warhouseId, new Guid(Session["GradingRecivedGradingId"].ToString())); this.cboGradingCode.DataSource = list; this.cboGradingCode.DataValueField = "Id"; this.cboGradingCode.DataTextField = "GradingCode"; this.cboGradingCode.DataBind(); if (Session["GradingRecivedGradingId"].ToString() != "") { this.cboGradingCode.SelectedValue = Session["GradingRecivedGradingId"].ToString(); //get Code Generated date. GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById(new Guid(this.cboGradingCode.SelectedValue.ToString())); if (objGrading != null) { this.lblCodeGeneratedDate.Text = objGrading.DateCoded.ToShortDateString(); //elias to remove. // this.cmpCodeGen.ValueToCompare = objGrading.DateCoded.ToShortDateString(); } LoadGrader(); LoadCommodity(); } } else { this.cboGradingCode.SelectedIndex = -1; return; } this.cboGradingCode.Enabled = false; }
public static bool InsertGrading(GradingBLL obj, SqlTransaction trans) { string strSql = "spInsertGrading"; //GradingDate SqlParameter[] arPar = new SqlParameter[8]; arPar[0] = new SqlParameter("@Id", SqlDbType.UniqueIdentifier); arPar[0].Value = obj.Id; arPar[1] = new SqlParameter("@SamplingResultId", SqlDbType.UniqueIdentifier); arPar[1].Value = obj.SamplingResultId; arPar[2] = new SqlParameter("@CommodityRecivingId", SqlDbType.UniqueIdentifier); arPar[2].Value = obj.CommodityRecivingId; arPar[3] = new SqlParameter("@GradingCode", SqlDbType.NVarChar, 50); arPar[3].Value = obj.GradingCode; arPar[4] = new SqlParameter("@Status", SqlDbType.Int); arPar[4].Value = obj.Status; arPar[5] = new SqlParameter("@CreatedBy", SqlDbType.UniqueIdentifier); arPar[5].Value = obj.CreatedBy; arPar[6] = new SqlParameter("@TransactionId", SqlDbType.NVarChar, 50); arPar[6].Value = obj.TrackingNo; //GradingDate arPar[7] = new SqlParameter("@DateCoded", SqlDbType.DateTime); arPar[7].Value = obj.DateCoded; int AffectedRows = 0; AffectedRows = SqlHelper.ExecuteNonQuery(trans, strSql, arPar); if (AffectedRows == 1) { return(true); } else { throw new Exception("Adding Coding Record failed"); } }
private void CoffeeCodingReport_ReportStart(object sender, EventArgs e) { Guid CommodityDepositeId = Guid.Empty; Guid WoredaId = Guid.Empty; GradingBLL objCode = new GradingBLL(); if (HttpContext.Current.Session["CodeReport"] != null) { objCode = (GradingBLL)HttpContext.Current.Session["CodeReport"]; } else { throw new Exception("Session expired."); } if (objCode != null) { this.txtDateCoded.Text = objCode.DateCoded.ToString("dd MMM-yyyy"); this.txtCode.Text = objCode.GradingCode.ToString(); CommodityDepositeId = objCode.CommodityRecivingId; } if (CommodityDepositeId != Guid.Empty) { CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL(); objCDR = objCDR.GetCommodityDepositeDetailById(CommodityDepositeId); if (objCDR != null) { WoredaId = objCDR.WoredaId; WoredaBLL objWoreda = new WoredaBLL(); objWoreda = objWoreda.GetWoredabyId(WoredaId); if (objWoreda != null) { this.txtOrigin.Text = objWoreda.WoredaName; } } } this.txtDateGenerated.Text = DateTime.Now.ToString("dd MMM-yyyy"); conn = Connection.getConnection(); GradingByBLL objGradersReader = new GradingByBLL(); reader = objGradersReader.GetGradersByGradingIdDataReader(objCode.Id, conn); }
private void LoadData() { this.cboGradingCode.Items.Clear(); List <GradingBLL> list = new List <GradingBLL>(); GradingBLL objGrading = new GradingBLL(); list = objGrading.GetGradingPenndingDispute(); this.cboGradingCode.Items.Add(new ListItem("Please Select Grading code", "")); if (list != null) { if (list.Count > 0) { foreach (GradingBLL i in list) { this.cboGradingCode.Items.Add(new ListItem(i.GradingCode.ToString(), i.Id.ToString())); } } } }
private void LoadPage(Guid Id) { GradingBLL obj = new GradingBLL(); obj = obj.GetById(Id); if (obj != null) { hfId.Value = Id.ToString(); this.lblGradingCode.Text = obj.GradingCode; this.txtDateCoded.Text = obj.DateCoded.ToShortDateString(); this.cmpCodeGen.ValueToCompare = obj.DateCoded.ToShortDateString(); ViewState["GradingTrackingNo"] = obj.TrackingNo; } else { this.lblMessage.Text = "An error has occured please log out and try again.If the error persists contact the administrator"; this.btnSave.Enabled = false; return; } }
protected void btnSearch_Click(object sender, EventArgs e) { list = null; GradingBLL obj = new GradingBLL(); string TrackingNo = this.txtTrackingNo.Text; string GradingCode = this.txtGradingCode.Text; string SamplingResultCode = this.txtSamplingCode.Text; Nullable <DateTime> from = null; Nullable <DateTime> to = null; try { from = DateTime.Parse(this.txtFrom.Text); } catch { from = null; } try { to = DateTime.Parse(this.txtTo.Text); } catch { to = null; } try { list = obj.Search(TrackingNo, GradingCode, SamplingResultCode, from, to); BindGrid(); } catch (NULLSearchParameterException) { this.lblmsg.Text = "Please provide Searching parameters"; } catch (Exception ex) { throw ex; } }
protected void gvCodeGenerated_RowCommand(object sender, GridViewCommandEventArgs e) { this.lblMsg.Text = ""; if (e.CommandName == "Print") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow rw = this.gvCodeGenerated.Rows[index]; Label lblId = (Label)rw.FindControl("lblId"); Guid Id = Guid.Empty; try { Id = new Guid(lblId.Text); if (Id != Guid.Empty) { GradingBLL objCodeReport = new GradingBLL(); objCodeReport = objCodeReport.GetById(Id); Session["CodeReport"] = objCodeReport; List <GradingByBLL> list = new List <GradingByBLL>(); GradingByBLL objGraders = new GradingByBLL(); list = objGraders.GetByGradingId(objCodeReport.Id); GradingByCollection objGraderCollection = new GradingByCollection(list); Session["GradersCodeReport"] = objGraderCollection; StringBuilder sb = new StringBuilder(); sb.Append("<script>"); sb.Append("window.open('rptCoffeeCode.aspx"); sb.Append("', '', 'toolbar=0');"); sb.Append("</scri"); sb.Append("pt>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ShowReport", sb.ToString(), false); } } catch (Exception ex) { throw ex; } } }
private void GradingCodeChanged() { Clear(); Nullable <Guid> GradingId = null; Guid CommodityDepositeRequestId; if (DataValidationBLL.isGUID(this.cboGradingCode.SelectedValue.ToString(), out GradingId) != true) { this.lblmsg.Text = "Please select Grading No."; return; } GradingBLL objGrading = new GradingBLL(); objGrading = objGrading.GetById((Guid)GradingId); if (objGrading == null) { this.lblmsg.Text = "Please select Grading No."; return; } if (objGrading.CommodityRecivingId == null) { this.lblmsg.Text = "Please select Grading No."; return; } else { CommodityDepositeRequestId = objGrading.CommodityRecivingId; } LoadDepositeRequest(CommodityDepositeRequestId); LoadSampling((Guid)GradingId); LoadGrading((Guid)GradingId); LoadUnloading((Guid)GradingId); ScalingInformation((Guid)GradingId); LoadNetWeight(); LoadQuantity(); }
protected void btnSave_Click(object sender, EventArgs e) { Guid Id = Guid.Empty; string strRemark = string.Empty; if (hfId.Value != null) { Id = new Guid(hfId.Value); } if (ViewState["GradingTrackingNo"] == null) { this.lblMessage.Text = "An error has occured please try agian.if the error persists contact the administrator."; return; } Nullable <DateTime> receivedDateTime = null; receivedDateTime = DateTime.Parse(txtDateRecived.Text + " " + txtTimeRecived.Text); strRemark = this.txtLabTechRemark.Text; GradingBLL obj = new GradingBLL(); obj.Id = Id; obj.IsCodeReceivedAtLab = true; obj.CodeReceivedTimeStamp = receivedDateTime; obj.TrackingNo = ViewState["GradingTrackingNo"].ToString(); if (obj.UpdateSampleCodeReceived()) { this.lblMessage.Text = "Data updated sucessfully."; this.btnClear.Enabled = true; this.btnSave.Enabled = false; return; } else { this.lblMessage.Text = "Unable to update data,please try agian."; return; } }
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; } }
protected void btnGenerateCode_Click(object sender, EventArgs e) { bool isSaved = false; this.lblMsg.Text = ""; string WarehouseNo; try { WarehouseNo = UserBLL.GetCurrentWarehouseCode(); } catch { this.lblMsg.Text = "No warehouse code,please try agian."; return; } if (string.IsNullOrEmpty(WarehouseNo) == true) { this.lblMsg.Text = "No warehouse code,please try agian."; return; } if (string.IsNullOrEmpty(this.cboSampleCode.SelectedItem.Text) == true) { this.lblMsg.Text = "Please if the sample code exists"; return; } string[] IdCollection = new string[3]; IdCollection = this.cboSampleCode.SelectedValue.Split('/'); Guid SamplingResultId = Guid.Empty; Guid ReceivigRequestId = Guid.Empty; try { SamplingResultId = new Guid(IdCollection[0].ToString()); ReceivigRequestId = new Guid(IdCollection[1].ToString()); } catch { this.lblMsg.Text = "Please if the sample code exists"; return; } string TrackingNo = IdCollection[2].ToString(); DateTime DateCoded = DateTime.Parse(this.txtDateCodeGenrated.Text + " " + txtTimeArrival.Text); GradingBLL objGrading = new GradingBLL(); if (SamplingResultId != Guid.Empty) { objGrading.SamplingResultId = SamplingResultId; } else { this.lblMsg.Text = "Please if the sample code exists"; return; } if (ReceivigRequestId != Guid.Empty) { objGrading.CommodityRecivingId = ReceivigRequestId; } else { this.lblMsg.Text = "Please if the sample code exists"; return; } objGrading.Status = GradingStatus.Coded; objGrading.TrackingNo = TrackingNo; objGrading.CreatedBy = UserBLL.GetCurrentUser(); objGrading.DateCoded = DateCoded; List <GradingByBLL> list = new List <GradingByBLL>(); list = (List <GradingByBLL>)Session["Graders"]; if (list == null) { this.lblMsg.Text = "Please provide graders."; return; } if (list.Count <= 0) { this.lblMsg.Text = "Please provide graders."; return; } if (isSingleSupervisorGrader(list) == false) { return; } Guid CommodityId = Guid.Empty; CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL(); objCDR = objCDR.GetCommodityDepositeDetailById(ReceivigRequestId); if (GradingByBLL.IsNumberofGraderAcceptable(list.Count, objCDR.CommodityId) == false) { this.lblMsg.Text = "The number of graders selected is less than the minimum required."; return; } if (list == null || list.Count <= 0) { this.lblMsg.Text = "Please add graders before generating code."; return; } if (this.hfTrackingNo.Value == "" || this.hfTrackingNo.Value == null) { this.lblMsg.Text = "An error has occured."; return; } isSaved = objGrading.Add(WarehouseNo, this.hfTrackingNo.Value.ToString(), list); if (isSaved == true) { // TODO Update a GridView dataBind and print the Coding Ticket. this.lblMsg.Text = "Data Added Successfully."; CommodityDepositeRequestBLL obj = new CommodityDepositeRequestBLL(); Session["Graders"] = null; this.gvGrader.DataSource = null; this.gvGrader.DataBind(); this.pnlGradingDetail.Visible = false; this.btnGenerateCode.Visible = false; LoadCode(objGrading.SamplingResultId); } else { this.lblMsg.Text = "Data can not be saved. Please check the data entered and try again.If the error persists, conatact the IT support."; } }
private static List <GradingBLL> SearchHelper(string strSql) { SqlDataReader reader; List <GradingBLL> list; SqlConnection conn = Connection.getConnection(); if (conn == null || conn.State != ConnectionState.Open) { throw new Exception("Invalid database connection."); } reader = SqlHelper.ExecuteReader(conn, CommandType.Text, strSql); if (reader.HasRows) { list = new List <GradingBLL>(); while (reader.Read()) { GradingBLL obj = new GradingBLL(); if (reader["Id"] != DBNull.Value) { obj.Id = new Guid(reader["Id"].ToString()); } if (reader["SamplingResultId"] != DBNull.Value) { obj.SamplingResultId = new Guid(reader["SamplingResultId"].ToString()); } if (reader["CommodityRecivingId"] != DBNull.Value) { obj.CommodityRecivingId = new Guid(reader["CommodityRecivingId"].ToString()); } if (reader["GradingCode"] != DBNull.Value) { obj.GradingCode = reader["GradingCode"].ToString(); } if (reader["DateCoded"] != DBNull.Value) { obj.DateCoded = DateTime.Parse(reader["DateCoded"].ToString()); } if (reader["Status"] != DBNull.Value) { obj.Status = (GradingStatus)(int.Parse(reader["Status"].ToString())); } if (reader["CreatedBy"] != DBNull.Value) { obj.CreatedBy = new Guid(reader["CreatedBy"].ToString()); } if (reader["CreatedTimestamp"] != DBNull.Value) { obj.CreatedTimestamp = DateTime.Parse(reader["CreatedTimestamp"].ToString()); } if (reader["LastModifiedBy"] != DBNull.Value) { obj.LastModifiedBy = new Guid(reader["LastModifiedBy"].ToString()); } if (reader["LastModifiedTimestamp"] != DBNull.Value) { obj.DateCoded = DateTime.Parse(reader["LastModifiedTimestamp"].ToString()); } obj.TrackingNo = reader["TransactionId"].ToString(); list.Add(obj); } return(list); } else { return(null); } }
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())); } } } }