protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { this.Page.DataBind(); if (Session["SamplingId"] != null) { Guid Id = Guid.Empty; Id = new Guid(Session["SamplingId"].ToString()); Session["SamplingId"] = null; if (Id != Guid.Empty) { SamplingBLL obj = new SamplingBLL(); obj = obj.GetSampleDetail(Id); obj.Id = Id; if (obj != null) { this.lblSampleCode.Text = obj.SampleCode; this.txtDateCodeGenrated.Text = obj.GeneratedTimeStamp.ToShortDateString(); this.txtTimeArrival.Text = obj.GeneratedTimeStamp.ToShortTimeString(); ViewState["SamplingId"] = Id; CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL(); objCDR = objCDR.GetCommodityDepositeDetailById(obj.ReceivigRequestId); if (objCDR != null) { lblArrivalDate.Text = objCDR.DateTimeRecived.ToShortDateString(); } } } } } }
private void rptSamplingResult_DataInitialize(object sender, EventArgs e) { SamplingResultBLL objSamplingResult = null; if (HttpContext.Current.Session["SamplingResultCode"] != null) { string Code = HttpContext.Current.Session["SamplingResultCode"].ToString(); objSamplingResult = new SamplingResultBLL(); objSamplingResult = objSamplingResult.GetSamplingResultBySamplingResultCode(Code); } else { throw new Exception("Session expired"); } if (objSamplingResult != null) { this.txtCode.Text = objSamplingResult.SamplingResultCode; this.txtNoBags.Text = objSamplingResult.NumberOfBags.ToString(); SamplingBLL objSampling = new SamplingBLL(); objSampling = objSampling.GetSampleDetail(objSamplingResult.SamplingId); this.txtDateSampled.Text = objSampling.GeneratedTimeStamp.ToString("dd MMM-yyyy"); this.txtDateGenerated.Text = DateTime.Now.ToString("dd MMM-yyyy"); DriverInformationBLL objDriver = new DriverInformationBLL(); List <DriverInformationBLL> listDriver = objDriver.GetActiveDriverInformationByReceivigRequestId(objSampling.ReceivigRequestId); if (listDriver != null) { this.txtPlateNo.Text = listDriver[0].TrailerPlateNumber.ToString(); this.txtTrailerPlateNo.Text = listDriver[0].TrailerPlateNumber.ToString(); } } this.txtDateGenerated.Text = DateTime.Now.ToString("dd MMM-yyyy"); }
protected void Page_Load(object sender, EventArgs e) { SamplingBLL Sampling; Guid id = new Guid(Request.QueryString["Id"].ToString()); SamplingBLL obj = new SamplingBLL(); Sampling = obj.GetSampleDetail(id); this.lblSamplingCode.Text = Sampling.SampleCode.ToString(); }
protected void gvScaling_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow rw = this.gvScaling.Rows[index]; if (e.CommandName == "edit") { Label lblId = (Label)rw.FindControl("lblId"); if (lblId.Text != "") { Session["SamplingId"] = lblId.Text; Response.Redirect("EditSampling.aspx"); } } else if (e.CommandName == "Print") { Label lblId = (Label)rw.FindControl("lblId"); if (lblId.Text != "") { Guid SId = Guid.Empty; SId = new Guid(lblId.Text); SamplingBLL objSample = new SamplingBLL(); objSample = objSample.GetSampleDetail(SId); if (objSample == null) { this.lblMessage.Text = "Unable to print sample Ticket"; return; } objSample.Id = SId; Session["Sample"] = objSample; SamplerBLL objSampler = new SamplerBLL(); objSampler = objSampler.GetSamplerBySamplingId(SId)[0]; Session["Sampler"] = objSampler; ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowReport", "<script type=\"text/javascript\">" + string.Format("javascript:window.open(\"ReportSampleTicket.aspx?id={0}\", \"_blank\",\"height=400px,width=600px,top=0,left=0,resizable=yes,scrollbars=yes\");", lblId.Text.ToString()) + "</script>", false); } } }
public void SamplingCodechanged() { Guid id = Guid.Empty; this.cboSampler.Items.Clear(); try { id = new Guid(this.cboSampleCode.SelectedValue.ToString()); } catch { this.lblMsg.Text = "An error has occured please try again.If the error persists contact the administrator"; return; } SamplerBLL obj = new SamplerBLL(); List <SamplerBLL> list = new List <SamplerBLL>(); SamplingBLL objSampling = new SamplingBLL(); objSampling = objSampling.GetSampleDetail(id); if (objSampling != null) { lblSampleGenratedDateTime.Text = objSampling.GeneratedTimeStamp.ToShortDateString(); //this.cmpSampGen.ValueToCompare = objSampling.GeneratedTimeStamp.ToShortDateString(); } else { this.lblMsg.Text = "An error has occured please try again.If the error persists contact the administrator"; return; } list = obj.GetSamplerBySamplingId(id); if (list != null) { this.cboSampler.Items.Add(new ListItem("Please Select Sampler.", "")); this.cboSampler.AppendDataBoundItems = true; foreach (SamplerBLL o in list) { this.cboSampler.Items.Add(new ListItem(o.SamplerName, o.SamplerId.ToString())); this.cboSampler.SelectedValue = o.SamplerId.ToString(); } } this.cboSampler.Enabled = false; }
private void rptSampleTicketCoffee_DataInitialize(object sender, EventArgs e) { this.txtDateGenerated.Text = DateTime.Today.ToString("dd MMM-yyyy"); //Load Sample ticket with data. if (HttpContext.Current.Session["Sample"] != null) { SamplingBLL objSampling = new SamplingBLL(); objSampling = (SamplingBLL)HttpContext.Current.Session["Sample"]; objSampling = objSampling.GetSampleDetail(objSampling.Id); this.txtDateSampled.Text = objSampling.GeneratedTimeStamp.ToString("dd MMM-yyyy"); this.txtCode.Text = objSampling.SampleCode.ToString(); EmployeeAttendanceBLL objEmployee = new EmployeeAttendanceBLL(); this.txtSamplerName.Text = UserRightBLL.GetUserNameByUserId(objSampling._sampler.SamplerId); VoucherInformationBLL objVoucher = new VoucherInformationBLL(); objVoucher = objVoucher.GetVoucherInformationByCommodityDepositRequestId(objSampling.ReceivigRequestId); if (objVoucher != null) { this.txtNoBags.Text = objVoucher.NumberofBags.ToString(); this.txtPlompTruck.Text = objVoucher.NumberOfPlomps.ToString(); this.txtPlompTrailer.Text = objVoucher.NumberOfPlompsTrailer.ToString(); } //Get Driver information. List <DriverInformationBLL> list = new List <DriverInformationBLL>(); DriverInformationBLL obj = new DriverInformationBLL(); list = obj.GetActiveDriverInformationByReceivigRequestId(objSampling.ReceivigRequestId); if (list != null) { if (list.Count == 1) { obj = list[0]; this.txtPlateNo.Text = obj.PlateNumber.ToString(); this.txtTrailerPlateNo.Text = obj.TrailerPlateNumber.ToString(); } } } HttpContext.Current.Session["Sample"] = null; HttpContext.Current.Session["Sampler"] = null; }