protected void btnimgSave_Click(object sender, ImageClickEventArgs e) { if (ViewState["BookingCntr"] != null) { Containers = (List <IBookingContainer>)ViewState["BookingCntr"]; } //IEnumerable<IBookingContainer> Rts = from IBookingContainer rt in Containers // where rt.BkCntrStatus == true // select rt; //_TotWeight = 0; lblMessage.Text = string.Empty; IBookingContainer obj = new BookingContainerEntity(); if (!string.IsNullOrEmpty(hdnIndex.Value)) { obj = Containers.ElementAt(Convert.ToInt32(hdnIndex.Value)); } else { foreach (BookingContainerEntity objBookingContainer in Containers) { if (objBookingContainer.ContainerTypeID.ToString() == ddlCntrType.SelectedValue && objBookingContainer.CntrSize == ddlSize.SelectedValue) { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00076") + "');</script>", false); return; } else { //_TotWeight = _TotWeight + (objBookingContainer.NoofContainers.ToDecimal() * objBookingContainer.wtPerCntr.ToDecimal()); } } } if ((String.IsNullOrEmpty(txtNos.Text))) // || String.IsNullOrEmpty(txtWtPerCntr.Text) { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00077") + "');</script>", false); return; } obj.BookingContainerID = Convert.ToInt32(hdnLeaseContainerID.Value); obj.ContainerTypeID = Convert.ToInt32(ddlCntrType.SelectedValue); obj.ContainerType = ddlCntrType.SelectedItem.Text; obj.CntrSize = ddlSize.SelectedValue; obj.NoofContainers = Convert.ToInt32(txtNos.Text); //obj.wtPerCntr = Convert.ToDecimal(txtWtPerCntr.Text); //_TotWeight = _TotWeight + (obj.NoofContainers.ToDecimal() * obj.wtPerCntr.ToDecimal()); if (string.IsNullOrEmpty(hdnIndex.Value)) { Containers.Add(obj); } gvContainer.DataSource = Containers; gvContainer.DataBind(); //txtGrossWeight.Text = _TotWeight.ToString(); ViewState["BookingCntr"] = Containers; ResetContainer(); //ModalPopupExtender1.Show(); }
public static List <IBookingContainer> GetJobContainers(int JobID) { string strExecution = "[fwd].[spGetJobContainerList]"; List <IBookingContainer> Containers = new List <IBookingContainer>(); using (DbQuery oDq = new DbQuery(strExecution)) { oDq.AddIntegerParam("@JobId", JobID); //oDq.AddIntegerParam("@Mode", 2); // @Mode = 2 to fetch ChargeRate DataTableReader reader = oDq.GetTableReader(); while (reader.Read()) { IBookingContainer Cont = new BookingContainerEntity(reader); Containers.Add(Cont); } reader.Close(); } return(Containers); }