コード例 #1
0
        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);
        }
コード例 #2
0
        public static List <ILease> GetLease(SearchCriteria searchCriteria, int ID)
        {
            string        strExecution = "[dbo].[prcGetLeaseList]";
            List <ILease> lstService   = new List <ILease>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@pk_LeaseID", ID);
                oDq.AddVarcharParam("@SchLeaseNo", 100, searchCriteria.StringOption1);
                oDq.AddVarcharParam("@SchLineName", 100, searchCriteria.LineName);
                oDq.AddVarcharParam("@SchLocationName", 100, searchCriteria.Location);
                oDq.AddVarcharParam("@SortExpression", 50, searchCriteria.SortExpression);
                oDq.AddVarcharParam("@SortDirection", 4, searchCriteria.SortDirection);
                DataTableReader reader = oDq.GetTableReader();


                while (reader.Read())
                {
                    ILease oIH = new LeaseEntity(reader);
                    lstService.Add(oIH);
                }
                reader.Close();
            }
            return(lstService);
        }
コード例 #3
0
        public static ILease GetLease(int ID)
        {
            string strExecution = "[dbo].[prcGetLeaseList]";
            ILease oIH          = null;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@pk_LeaseID", ID);
                oDq.AddVarcharParam("@SortExpression", 30, "");
                oDq.AddVarcharParam("@SortDirection", 4, "");
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    oIH = new LeaseEntity(reader);
                }
                reader.Close();
            }
            return(oIH);
        }
コード例 #4
0
        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");
            }
        }