private int AddContainers(int BookingId) { if (ViewState["BookingCntr"] != null) { Containers = (List <IBookingContainer>)ViewState["BookingCntr"]; } if (Containers.Count > 0) { foreach (BookingContainerEntity obj in Containers) { oBookingBll = new LeaseBLL(); obj.BookingID = BookingId; int res = oBookingBll.AddEditLeaseContainer(obj); if (res != 1) { return(res); } } return(1); } return(1); }
private void FillLease(Int32 LeaseID) { //oBookingEntity = new BookingEntity(); //oBookingBll = new BookingBLL(); //oBookingEntity = (BookingEntity)oBookingBll.GetBooking(BookingID); LeaseEntity oBooking = (LeaseEntity)LeaseBLL.GetLease(Convert.ToInt32(hdnLeaseID.Value)); //ddlLocation.SelectedIndexChanged += new EventHandler(ddlLocation_SelectedIndexChanged); //ddlFromLocation.SelectedIndex = Convert.ToInt32(ddlFromLocation.Items.IndexOf(ddlFromLocation.Items.FindByValue(oImportHaulage.LocationFrom))); ddlLocation.SelectedValue = oBooking.LocationID.ToString(); ddlLocation_SelectedIndexChanged(null, null); ddlEmptyYard.SelectedValue = oBooking.fk_EmptyYardID.ToString(); //hdnFPOD.Value = oBooking.FPODID.ToString(); //hdnPOD.Value = oBooking.PODID.ToString(); //hdnPOL.Value = oBooking.POLID.ToString(); //hdnPOR.Value = oBooking.PORID.ToString(); //hdnVessel.Value = oBooking.VesselID.ToString(); //hdnMainLineVessel.Value = oBooking.MainLineVesselID.ToString(); ddlNvocc.SelectedValue = oBooking.LinerID.ToString(); ddlLocation.SelectedValue = oBooking.LocationID.ToString(); txtLeaseCompany.Text = oBooking.LeaseCompany.ToString(); txtLeaseDate.Text = oBooking.LeaseDate.ToShortDateString(); txtLeaseNo.Text = oBooking.LeaseNo.ToString(); txtLeaseValidity.Text = oBooking.LeaseValidTill.ToShortDateString(); hdnLeaseID.Value = Convert.ToString(oBooking.LeaseID); }
void AddContainers() { Containers = (List <IBookingContainer>)ViewState["BookingCntr"]; if (Containers == null) { Containers = new List <IBookingContainer>(); } oBookingBll = new LeaseBLL(); oBookingBll.DeactivateAllContainersAgainstLeaseId(Convert.ToInt32(hdnLeaseID.Value)); foreach (IBookingContainer Container in Containers) { Container.BookingID = Convert.ToInt32(hdnLeaseID.Value); oBookingBll.AddEditLeaseContainer(Container); } }
void FillLeaseContainer(Int32 LeaseID) { //oChargeRates = new List<ChargeRateEntity>(); //oChargeRates = new List<ChargeRateEntity>(); oBookingBll = new LeaseBLL(); Containers = new List <IBookingContainer>(); Containers = oBookingBll.GetLeaseContainers(LeaseID); //foreach (BookingContainerEntity obj in Containers) //{ // _TotWeight = _TotWeight + obj.NoofContainers.ToDecimal() * obj.wtPerCntr.ToDecimal(); //} //txtGrossWeight.Text = _TotWeight.ToString(); ViewState["BookingCntr"] = Containers; gvContainer.DataSource = Containers; gvContainer.DataBind(); }
private void LoadLease() { if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null)) { SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA]; if (!ReferenceEquals(searchCriteria, null)) { BuildSearchCriteria(searchCriteria); CommonBLL commonBll = new CommonBLL(); gvwLeaseReference.PageIndex = searchCriteria.PageIndex; if (searchCriteria.PageSize > 0) { gvwLeaseReference.PageSize = searchCriteria.PageSize; } gvwLeaseReference.DataSource = LeaseBLL.GetLease(searchCriteria, 0); gvwLeaseReference.DataBind(); } } }
private void DeleteLeaseRef(int LeaseId) { LeaseBLL.DeleteLease(LeaseId); LoadLease(); ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00010") + "');</script>", false); }
protected void btnSave_Click1(object sender, EventArgs e) { if (Page.IsValid) { //if (Convert.ToDecimal(txtWFrom.Text) > Convert.ToDecimal(txtWTo.Text)) //{ // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00077") + "');</script>", false); // return; //} if (ViewState["BookingCntr"] != null) { Containers = (List <IBookingContainer>)ViewState["BookingCntr"]; } oBookingBll = new LeaseBLL(); oBookingEntity = new LeaseEntity(); if (hdnLeaseID.Value == "0" || hdnLeaseID.Value == string.Empty) { if (oBookingBll.CheckForDuplicateLease(txtLeaseNo.Text) != 0) { lblError.Text = "Duplicate Lease No. Entry rejected"; return; } } //oUserEntity = (UserEntity)Session[Constants.SESSION_USER_INFO]; // This section has been commented temporarily oBookingEntity.LinerID = ddlNvocc.SelectedValue.ToInt(); oBookingEntity.LocationID = ddlLocation.SelectedValue.ToInt(); oBookingEntity.LeaseID = Convert.ToInt32(hdnLeaseID.Value); oBookingEntity.LeaseNo = Convert.ToString(txtLeaseNo.Text); oBookingEntity.LeaseValidTill = Convert.ToDateTime(txtLeaseValidity.Text); oBookingEntity.LeaseCompany = txtLeaseCompany.Text.ToString(); oBookingEntity.LeaseDate = txtLeaseDate.Text.ToDateTime(); oBookingEntity.fk_EmptyYardID = ddlEmptyYard.SelectedValue.ToInt(); if (hdnLeaseID.Value == "0") // Insert { oBookingEntity.CreatedBy = _userId; // oUserEntity.Id; oBookingEntity.CreatedOn = DateTime.Today.Date; oBookingEntity.ModifiedBy = _userId; // oUserEntity.Id; oBookingEntity.ModifiedOn = DateTime.Today.Date; int outLeaseId = 0; switch (oBookingBll.AddEditLease(oBookingEntity, _CompanyId, ref outLeaseId)) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076"); break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); ClearAll(); break; case 1: oBookingBll.DeactivateAllContainersAgainstLeaseId(outLeaseId); switch (AddContainers(outLeaseId)) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076"); break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); ClearAll(); break; case 1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009"); ClearAll(); break; } break; } } else // Update { oBookingEntity.LeaseID = Convert.ToInt32(hdnLeaseID.Value); oBookingEntity.ModifiedBy = _userId;// oUserEntity.Id; oBookingEntity.ModifiedOn = DateTime.Today.Date; oBookingEntity.Action = true; // int outLeaseId = 0; switch (oBookingBll.AddEditLease(oBookingEntity, _CompanyId, ref outLeaseId)) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076"); break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); break; case 1: oBookingBll.DeactivateAllContainersAgainstLeaseId(outLeaseId); switch (AddContainers(outLeaseId)) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076"); break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); ClearAll(); break; case 1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009"); ClearAll(); break; } break; } } Response.Redirect("~/Equipment/LeaseReference.aspx"); } }
public LeaseController(LeaseBLL bll) { _bll = bll; }