コード例 #1
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_EDIT"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["unit_id"] == null) || ((string)Request.QueryString["unit_type"] == null) || ((string)Request.QueryString["unit_state"] == null) || ((string)Request.QueryString["active_tab"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in units_state.aspx");
                }

                // Tag Page
                hdfUnitId.Value = Request.QueryString["unit_id"].ToString();
                hdfUnitType.Value = Request.QueryString["unit_type"].ToString();
                hdfActiveTab.Value = Request.QueryString["active_tab"].ToString();
                hdfUnitState.Value = Request.QueryString["unit_state"].ToString();
                hdfNewUnitState.Value = Request.QueryString["new_unit_state"].ToString();
                hdfCompanyId.Value = Session["companyID"].ToString();

                // If coming from units_summary.aspx
                if ((string)Request.QueryString["source_page"] == "units_summary.aspx")
                {
                    // Store Navigator State and Update control
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                    int unitId = Int32.Parse(hdfUnitId.Value.Trim());

                    unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                    UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                    unitInformationUnitDetails.LoadByUnitId(unitId, companyId);

                    // Store dataset
                    Session["unitInformationTDS"] = unitInformationTDS;
                }

                // Restore dataset
                unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
            }
            else
            {
                // Restore dataset
                unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
            }
        }
コード例 #2
0
        protected void btnAssociate_Click(object sender, EventArgs e)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                string associateCategory = tvCategoriesRoot.SelectedNode.Text;
                int libraryCategoryId = int.Parse(tvCategoriesRoot.SelectedNode.Value);

                UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                unitInformationUnitDetails.UpdateLibraryCategoriesId(int.Parse(ViewState["unitId"].ToString()), libraryCategoryId);
                Session["unitInformationTDS"] = unitInformationTDS;

                Response.Write("<script language='javascript'> {window.close();}</script>");
            }
        }
コード例 #3
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_VIEW"]) && (Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_EDIT"]) || Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_COMMENTS"]))))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["unit_id"] == null) || ((string)Request.QueryString["unit_type"] == null) || ((string)Request.QueryString["unit_state"] == null)  || ((string)Request.QueryString["active_tab"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in units_summary.aspx");
                }

                // Tag Page
                hdfUnitId.Value = Request.QueryString["unit_id"].ToString();
                hdfUnitType.Value = Request.QueryString["unit_type"].ToString();
                hdfUnitState.Value = Request.QueryString["unit_state"].ToString();
                hdfActiveTab.Value = Request.QueryString["active_tab"].ToString();
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString();

                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int unitId = Int32.Parse(hdfUnitId.Value.Trim());

                Session.Remove("unitsChecklistRulesTempDummy");
                Session.Remove("unitsServicesTempDummy");
                Session.Remove("unitsInspectionsTempDummy");
                Session.Remove("unitsNotesTempDummy");
                Session.Remove("unitsCostsDummy");
                Session.Remove("unitsCostsExceptionsDummy");
                Session.Remove("costIdSelected");

                // If coming from
                // ... units_navigator2.aspx or wucAlarms.ascx.cs
                if ((Request.QueryString["source_page"] == "units_navigator2.aspx") || (Request.QueryString["source_page"] == "wucAlarms.ascx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    // ... ... Set initial tab
                    if ((string)Session["dialogOpenedUnits"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];

                        unitInformationTDS = new UnitInformationTDS();
                        unitsChecklistRulesTemp = new UnitInformationTDS.ChecklistDetailsDataTable();
                        unitsServicesTemp = new UnitInformationTDS.ServiceDetailsDataTable();
                        unitsInspectionsTemp = new UnitInformationTDS.InspectionDetailsDataTable();
                        unitsNotesTemp = new UnitInformationTDS.NoteInformationDataTable();

                        UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                        unitInformationUnitDetails.LoadByUnitId(unitId, companyId);

                        UnitInformationInspectionDetails unitInformationInspectionDetailsForEdit = new UnitInformationInspectionDetails(unitInformationTDS);
                        unitInformationInspectionDetailsForEdit.LoadByUnitId(unitId, companyId);

                        UnitInformationNoteDetails unitInformationNoteDetails = new UnitInformationNoteDetails(unitInformationTDS);
                        unitInformationNoteDetails.LoadByUnitId(unitId, companyId);

                        UnitInformationCostInformation unitInformationCostInformation = new UnitInformationCostInformation(unitInformationTDS);
                        unitInformationCostInformation.LoadAllByUnitId(unitId, companyId);

                        UnitInformationCostExceptionsInformation unitInformationCostExceptionsInformation = new UnitInformationCostExceptionsInformation(unitInformationTDS);
                        unitInformationCostExceptionsInformation.LoadAllByUnitId(unitId, companyId);

                        Session["costIdSelected"] = 0;

                        // ... For Categories
                        categoriesTDS = new CategoriesTDS();
                        Category category = new Category(categoriesTDS);
                        category.LoadByUnitType(hdfUnitType.Value, int.Parse(hdfCompanyId.Value));

                        // .. For Company Levels
                        companyLevelsTDS = new CompanyLevelsTDS();
                        CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                        companyLevel.Load(int.Parse(hdfCompanyId.Value));
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabUnits"];

                        // Restore datasets
                        unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                        unitsChecklistRulesTemp = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesTemp"];
                        unitsServicesTemp = (UnitInformationTDS.ServiceDetailsDataTable)Session["unitsServicesTemp"];
                        unitsInspectionsTemp = (UnitInformationTDS.InspectionDetailsDataTable)Session["unitsInspectionsTemp"];
                        unitsNotesTemp = (UnitInformationTDS.NoteInformationDataTable)Session["unitsNotesTemp"];
                        categoriesTDS = (CategoriesTDS)Session["categoriesTDSForUnits"];
                        companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];
                    }

                    tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                    // Store dataset
                    Session["unitInformationTDS"] = unitInformationTDS;
                    Session["unitsChecklistRulesTemp"] = unitsChecklistRulesTemp;
                    Session["unitsServicesTemp"] = unitsServicesTemp;
                    Session["unitsInspectionsTemp"] = unitsInspectionsTemp;
                    Session["unitsNotesTemp"] = unitsNotesTemp;
                    Session["categoriesTDSForUnits"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

                // ... units_add.aspx
                if (Request.QueryString["source_page"] == "units_add.aspx")
                {
                    ViewState["update"] = "yes";

                    hdfActiveTab.Value = Request.QueryString["active_tab"];

                    unitInformationTDS = new UnitInformationTDS();
                    unitsChecklistRulesTemp = new UnitInformationTDS.ChecklistDetailsDataTable();
                    unitsServicesTemp = new UnitInformationTDS.ServiceDetailsDataTable();
                    unitsInspectionsTemp = new UnitInformationTDS.InspectionDetailsDataTable();
                    unitsNotesTemp = new UnitInformationTDS.NoteInformationDataTable();

                    UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                    unitInformationUnitDetails.LoadByUnitId(unitId, companyId);

                    UnitInformationNoteDetails unitInformationNoteDetails = new UnitInformationNoteDetails(unitInformationTDS);
                    unitInformationNoteDetails.LoadByUnitId(unitId, companyId);

                    // ... For Categories
                    categoriesTDS = new CategoriesTDS();
                    Category category = new Category(categoriesTDS);
                    category.LoadByUnitType(hdfUnitType.Value, int.Parse(hdfCompanyId.Value));

                    // .. For Company Levels
                    companyLevelsTDS = new CompanyLevelsTDS();
                    CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                    companyLevel.Load(int.Parse(hdfCompanyId.Value));

                    tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                    // Store dataset
                    Session["unitInformationTDS"] = unitInformationTDS;
                    Session["unitsChecklistRulesTemp"] = unitsChecklistRulesTemp;
                    Session["unitsServicesTemp"] = unitsServicesTemp;
                    Session["unitsInspectionsTemp"] = unitsInspectionsTemp;
                    Session["unitsNotesTemp"] = unitsNotesTemp;
                    Session["categoriesTDSForUnits"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

                // ... units_delete.aspx, units_edit.aspx or units_state.aspx
                if ((Request.QueryString["source_page"] == "units_delete.aspx") || (Request.QueryString["source_page"] == "units_edit.aspx") || (Request.QueryString["source_page"] == "units_state.aspx") )
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                    unitsChecklistRulesTemp = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesTemp"];
                    unitsServicesTemp = (UnitInformationTDS.ServiceDetailsDataTable)Session["unitsServicesTemp"];
                    unitsInspectionsTemp = (UnitInformationTDS.InspectionDetailsDataTable)Session["unitsInspectionsTemp"];
                    unitsNotesTemp = (UnitInformationTDS.NoteInformationDataTable)Session["unitsNotesTemp"];
                    categoriesTDS = (CategoriesTDS)Session["categoriesTDSForUnits"];
                    companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedUnits"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabUnits"];
                    }

                    tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);
                }

                string filterOptions = string.Format("CostID = {0} AND Deleted = {1}", 0, 0);
                odsCostsExceptions.FilterExpression = filterOptions;

                // ... Data for current unit
                LoadUnitData(unitId, companyId);
            }
            else
            {
                // Restore datasets
                unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                unitsChecklistRulesTemp = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesTemp"];
                unitsServicesTemp = (UnitInformationTDS.ServiceDetailsDataTable)Session["unitsServicesTemp"];
                unitsInspectionsTemp = (UnitInformationTDS.InspectionDetailsDataTable)Session["unitsInspectionsTemp"];
                unitsNotesTemp = (UnitInformationTDS.NoteInformationDataTable)Session["unitsNotesTemp"];
                categoriesTDS = (CategoriesTDS)Session["categoriesTDSForUnits"];
                companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];

                // Set initial tab
                int activeTabUnits = Int32.Parse(hdfActiveTab.Value);
                tcDetailedInformation.ActiveTabIndex = activeTabUnits;
            }
        }
コード例 #4
0
        private void UpdateDatabase()
        {
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int unitId = Int32.Parse(hdfUnitId.Value);

            LibraryFilesGateway libraryFilesGateway = new LibraryFilesGateway(libraryTDSForUnits);
            libraryFilesGateway.Update();

            DB.Open();
            DB.BeginTransaction();
            try
            {
                // ... if can edit everything
                if (Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_EDIT"]))
                {
                    // Save inspection details
                    UnitInformationInspectionDetails unitInformationInspectionDetails = new UnitInformationInspectionDetails(unitInformationTDS);
                    unitInformationInspectionDetails.Save(unitId, companyId);

                    // Save notes information
                    UnitInformationNoteDetailsGateway unitInformationNoteDetailsGateway = new UnitInformationNoteDetailsGateway(unitInformationTDS);
                    UnitInformationNoteDetails unitInformationNoteDetails = new UnitInformationNoteDetails(unitInformationTDS);

                    foreach (UnitInformationTDS.NoteInformationRow rowNotes in (UnitInformationTDS.NoteInformationDataTable)unitInformationNoteDetailsGateway.Table)
                    {
                        if (!rowNotes.IsLIBRARY_FILES_IDNull())
                        {
                            if (rowNotes.LIBRARY_FILES_ID == 0 && rowNotes.FILENAME != "")
                            {
                                libraryFilesGateway.LoadByFileName(rowNotes.FILENAME, companyId);
                                int newLibraryFilesId = libraryFilesGateway.GetlibraryFilesId(rowNotes.FILENAME);

                                rowNotes.LIBRARY_FILES_ID = newLibraryFilesId;
                            }
                        }
                    }

                    unitInformationNoteDetails.Save(companyId);

                    // Save costs information
                    UnitInformationCostInformation unitInformationCostInformation = new UnitInformationCostInformation(unitInformationTDS);
                    unitInformationCostInformation.Save(companyId);

                    // Save costs exceptions information
                    UnitInformationCostExceptionsInformation unitInformationCostExceptionsInformation = new UnitInformationCostExceptionsInformation(unitInformationTDS);
                    unitInformationCostExceptionsInformation.Save(companyId, unitId);

                    // Save unit details
                    UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                    unitInformationUnitDetails.Save(arrayCategoriesSelectedForEdit, companyId);
                }

                // ... if could only edit notes
                if (!Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_EDIT"]) && Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_COMMENTS"]))
                {
                    // Save notes information
                    UnitInformationNoteDetailsGateway unitInformationNoteDetailsGateway = new UnitInformationNoteDetailsGateway(unitInformationTDS);
                    UnitInformationNoteDetails unitInformationNoteDetails = new UnitInformationNoteDetails(unitInformationTDS);

                    foreach (UnitInformationTDS.NoteInformationRow rowNotes in (UnitInformationTDS.NoteInformationDataTable)unitInformationNoteDetailsGateway.Table)
                    {
                        if (!rowNotes.IsLIBRARY_FILES_IDNull())
                        {
                            if (rowNotes.LIBRARY_FILES_ID == 0 && rowNotes.FILENAME != "")
                            {
                                libraryFilesGateway.LoadByFileName(rowNotes.FILENAME, companyId);
                                int newLibraryFilesId = libraryFilesGateway.GetlibraryFilesId(rowNotes.FILENAME);

                                rowNotes.LIBRARY_FILES_ID = newLibraryFilesId;
                            }
                        }
                    }

                    unitInformationNoteDetails.Save(companyId);
                }

                DB.CommitTransaction();

                // Store datasets
                unitInformationTDS.AcceptChanges();
                libraryTDSForUnits.AcceptChanges();
                Session["unitInformationTDS"] = unitInformationTDS;
                Session["libraryTDSForUnits"] = libraryTDSForUnits;
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
コード例 #5
0
        private void Save2()
        {
            // Validate data
            bool validData = true;

            // For valid data
            if (validData)
            {
                // Validate Ryder Specied
                if (ddlInsuranceClass.SelectedValue == "Ryder Specified")
                {
                    Page.Validate("generalSpecial");
                }

                // Notes Gridview, if the gridview is edition mode
                if (grdNotes.EditIndex >= 0)
                {
                    grdNotes.UpdateRow(grdNotes.EditIndex, true);
                }

                // Inspections Gridview, if the gridview is edition mode
                if (grdInspections.EditIndex >= 0)
                {
                    grdInspections.UpdateRow(grdInspections.EditIndex, true);
                }

                // Costs Gridview, if the gridview is edition mode
                if (grdCosts.EditIndex >= 0)
                {
                    grdCosts.UpdateRow(grdCosts.EditIndex, true);
                }

                // Costs Exceptions Gridview, if the gridview is edition mode
                if (grdCostsExceptions.EditIndex >= 0)
                {
                    grdCostsExceptions.UpdateRow(grdCostsExceptions.EditIndex, true);
                }

                // If there is data at the footers
                GrdNotesAdd();
                InspectionsAddNew();
                GrdCostsAdd();
                GrdCostsExceptionsAdd();

                // Basic
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int unitId = Int32.Parse(hdfUnitId.Value);

                // General
                string code = tbxCode.Text;
                string description = ""; if (tbxDescription.Text != "") description = tbxDescription.Text;
                string vin = ""; if (tbxVinSn.Text != "") vin = tbxVinSn.Text;
                string manufacturer = ""; if (tbxManufacturer.Text != "") manufacturer = tbxManufacturer.Text;
                string model = ""; if (tbxModel.Text != "") model = tbxModel.Text;
                string year = ""; if (tbxYear.Text != "") year = tbxYear.Text;
                bool isTowable = (cbxIsTowable.Checked) ? isTowable = true : isTowable = false;
                int companyLevelIdSelected = 0;
                arrayCompanyLevelsSelectedForEdit.Clear();
                foreach (TreeNode nodes in tvCompanyLevelsRoot.Nodes)
                {
                    GetCompanyLevelsSelected(nodes);
                }
                DateTime? acquisitionDate = null; if (tkrdpAcquisitionDate.SelectedDate.HasValue) acquisitionDate = tkrdpAcquisitionDate.SelectedDate.Value;
                DateTime? dispositionDate = null; if (tkrdpDispositionDate.SelectedDate.HasValue) dispositionDate = tkrdpDispositionDate.SelectedDate.Value;
                string dispositionReason = ""; if (tbxDispositionReason.Text != "") dispositionReason = tbxDispositionReason.Text;

                foreach (int companyLevelId in arrayCompanyLevelsSelectedForEdit)
                {
                    companyLevelIdSelected = companyLevelId;
                }

                // Plate
                Int64? licenseCountry = null;
                Int64? licenceState = null;
                string licensePlateNumber = ""; if (tbxLicensePlateNumber.Text != "") licensePlateNumber = tbxLicensePlateNumber.Text;
                string apportionedTagNumber = ""; // This field will not be shown

                // Technical
                string actualWeight = "";
                string registeredWeight = "";
                string tireSizeFront = "";
                string tireSizeBack = "";
                string numberOfAxes = "";
                string fuelType = "";
                string beginningOdometer = ""; if (tbxBeginningOdometer.Text != "") beginningOdometer = tbxBeginningOdometer.Text;
                bool isRefeerEquipped = cbxIsReeferEquipped.Checked;
                bool isPtoEquipped = cbxIsPtoEquipped.Checked;

                if (hdfUnitType.Value == "Vehicle")
                {
                    if (ddlLicenseCountry.SelectedValue != "-1")
                    {
                        licenseCountry = Int64.Parse(ddlLicenseCountry.SelectedValue);

                        if (licenseCountry.ToString() == "1")
                        {
                            // Ontario
                            hdfLicenseStateId.Value = "12435";
                            licenceState = Int64.Parse(hdfLicenseStateId.Value);
                        }
                        else
                        {
                            if (licenseCountry.ToString() == "2")
                            {
                                // Michigan
                                hdfLicenseStateId.Value = "84026";
                                licenceState = Int64.Parse(hdfLicenseStateId.Value);
                            }
                        }
                    }

                    actualWeight = tbxActualWeight.Text;
                    registeredWeight = tbxRegisteredWeight.Text;
                    tireSizeFront = tbxTireSizeFront.Text;
                    tireSizeBack = tbxTireSizeBack.Text;
                    numberOfAxes = ddlNumberOfAxes.SelectedValue;
                    fuelType = ddlFuelType.SelectedValue;
                }

                // Ownership
                string ownerType = ddlOwnerType.SelectedValue;
                Int64? ownerCountry = null;
                Int64? ownerState = null;
                string ownerName = ""; if (tbxOwnerName.Text != "") ownerName = tbxOwnerName.Text;
                string ownerContact = ""; if (tbxOwnerContact.Text != "") ownerContact = tbxOwnerContact.Text;

                if (ddlOwnerCountry.SelectedValue != "-1")
                {
                    ownerCountry = Int64.Parse(ddlOwnerCountry.SelectedValue);

                    if (ddlOwnerState.SelectedValue != "-1")
                    {
                        ownerState = Int64.Parse(ddlOwnerState.SelectedValue);
                    }
                }

                // Qualification Details
                DateTime? qualifiedDate = null; if (tkrdpQualifiedDate.SelectedDate.HasValue) qualifiedDate = tkrdpQualifiedDate.SelectedDate.Value;
                DateTime? notQualifiedDate = null; if (tkrdpNotQualifiedDate.SelectedDate.HasValue) notQualifiedDate = tkrdpNotQualifiedDate.SelectedDate.Value;
                string notQualifiedExplain = ""; if (tbxIfNotQualifiedExplain.Text != "") notQualifiedExplain = tbxIfNotQualifiedExplain.Text;

                string insuranceClass = ddlInsuranceClass.SelectedValue;
                string insuranceClassRyderSpecified = "";
                if (ddlInsuranceClass.SelectedValue == "Ryder Specified")
                {
                    insuranceClassRyderSpecified = tbxRyderSpecified.Text;
                }
                decimal? purchasePrice = null; if (tbxPurchasePrice.Text != "") purchasePrice = Convert.ToDecimal(tbxPurchasePrice.Text);
                DateTime? scrapDate = null; if (tkrdpScrapDate.SelectedDate.HasValue) scrapDate = tkrdpScrapDate.SelectedDate.Value;
                decimal? saleProceeds = null; if (tbxSaleProceeds.Text != "") saleProceeds = Convert.ToDecimal(tbxSaleProceeds.Text);

                UnitInformationUnitDetailsGateway UnitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS);
                int? libraryCategoriesId = null; if (UnitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)).HasValue) libraryCategoriesId = (int)UnitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value));

                // Update unit data
                UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                unitInformationUnitDetails.Update(unitId, code, description, vin, manufacturer, model, year, isTowable, companyLevelIdSelected, acquisitionDate, dispositionDate, dispositionReason, licenseCountry, licenceState, licensePlateNumber, apportionedTagNumber, actualWeight, registeredWeight, tireSizeFront, tireSizeBack, numberOfAxes, fuelType, beginningOdometer, isRefeerEquipped, isPtoEquipped, ownerType, ownerCountry, ownerState, ownerName, ownerContact, qualifiedDate, notQualifiedDate, notQualifiedExplain, insuranceClass, insuranceClassRyderSpecified, purchasePrice, scrapDate, saleProceeds, libraryCategoriesId);

                Session["arrayCategoriesSelectedForEdit"] = arrayCategoriesSelectedForEdit;
                Session["arrayCompanyLevelsSelectedForEdit"] = arrayCompanyLevelsSelectedForEdit;

                // Store dataset
                Session["unitInformationTDS"] = unitInformationTDS;
                Session["categoriesTDSForUnits"] = categoriesTDS;
                Session["companyLevelsTDS"] = companyLevelsTDS;

                ViewState["update"] = "no";
            }
        }
コード例 #6
0
        protected void btnUnassociate_Click(object sender, EventArgs e)
        {
            Session["activeTabUnits"] = "8";
            Session["dialogOpenedUnits"] = "1";

            UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
            unitInformationUnitDetails.UpdateLibraryCategoriesId(int.Parse(hdfUnitId.Value), null);

            ViewState["update"] = "no";

            btnUnassociate.Visible = false;
            btnAssociate.Visible = true;
            tbxCategoryAssocited.Text = "";
        }
コード例 #7
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_VIEW"]) && (Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_EDIT"]) || Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_UNITS_COMMENTS"]))))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["unit_id"] == null) || ((string)Request.QueryString["unit_type"] == null) || ((string)Request.QueryString["unit_state"] == null) || ((string)Request.QueryString["active_tab"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in units_edit.aspx");
                }

                // Tag Page
                hdfUnitId.Value = Request.QueryString["unit_id"].ToString();
                hdfUnitType.Value = Request.QueryString["unit_type"].ToString();
                hdfUnitState.Value = Request.QueryString["unit_state"].ToString();
                hdfActiveTab.Value = Request.QueryString["active_tab"].ToString();
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString();

                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int unitId = Int32.Parse(hdfUnitId.Value.Trim());

                aceManufacturer.ContextKey = hdfCompanyId.Value;

                // ... For Owner country
                CountryList countryList = new CountryList();
                countryList.LoadAndAddItem(-1, "(Select a country)");
                ddlOwnerCountry.DataSource = countryList.Table;
                ddlOwnerCountry.DataValueField = "CountryID";
                ddlOwnerCountry.DataTextField = "Name";
                ddlOwnerCountry.DataBind();

                // ... For License country
                ddlLicenseCountry.DataSource = countryList.Table;
                ddlLicenseCountry.DataValueField = "CountryID";
                ddlLicenseCountry.DataTextField = "Name";
                ddlLicenseCountry.DataBind();

                Session.Remove("unitsChecklistRulesTempDummy");
                Session.Remove("unitsServicesTempDummy");
                Session.Remove("unitsInspectionsTempDummy");
                Session.Remove("unitsNotesTempDummy");
                Session.Remove("unitCostsDummy");
                Session.Remove("unitCostsExceptionsDummy");
                Session.Remove("costIdSelected");

                // ... units_navigator2.aspx
                if (Request.QueryString["source_page"] == "units_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedUnits"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];

                        unitInformationTDS = new UnitInformationTDS();
                        unitsChecklistRulesTemp = new UnitInformationTDS.ChecklistDetailsDataTable();
                        unitsServicesTemp = new UnitInformationTDS.ServiceDetailsDataTable();
                        unitsInspectionsTemp = new UnitInformationTDS.InspectionDetailsDataTable();
                        unitsNotesTemp = new UnitInformationTDS.NoteInformationDataTable();

                        UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                        unitInformationUnitDetails.LoadByUnitId(unitId, companyId);

                        UnitInformationInspectionDetails unitInformationInspectionDetailsForEdit = new UnitInformationInspectionDetails(unitInformationTDS);
                        unitInformationInspectionDetailsForEdit.LoadByUnitId(unitId, companyId);

                        UnitInformationNoteDetails unitInformationNoteDetailsForEdit = new UnitInformationNoteDetails(unitInformationTDS);
                        unitInformationNoteDetailsForEdit.LoadByUnitId(unitId, companyId);

                        UnitInformationCostInformation unitInformationCostInformation = new UnitInformationCostInformation(unitInformationTDS);
                        unitInformationCostInformation.LoadAllByUnitId(unitId, companyId);

                        UnitInformationCostExceptionsInformation unitInformationCostExceptionsInformation = new UnitInformationCostExceptionsInformation(unitInformationTDS);
                        unitInformationCostExceptionsInformation.LoadAllByUnitId(unitId, companyId);

                        // ... For Categories
                        categoriesTDS = new CategoriesTDS();
                        Category category = new Category(categoriesTDS);
                        category.LoadByUnitType(hdfUnitType.Value, int.Parse(hdfCompanyId.Value));

                        // .. For Company Levels
                        companyLevelsTDS = new CompanyLevelsTDS();
                        CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                        companyLevel.Load(int.Parse(hdfCompanyId.Value));
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabUnits"];

                        // Restore datasets
                        unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                        unitsChecklistRulesTemp = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesTemp"];
                        unitsServicesTemp = (UnitInformationTDS.ServiceDetailsDataTable)Session["unitsServicesTemp"];
                        unitsInspectionsTemp = (UnitInformationTDS.InspectionDetailsDataTable)Session["unitsInspectionsTemp"];
                        unitsNotesTemp = (UnitInformationTDS.NoteInformationDataTable)Session["unitsNotesTemp"];
                        categoriesTDS = (CategoriesTDS)Session["categoriesTDSForUnits"];
                        companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];
                    }

                    arrayCategoriesSelectedForEdit = new ArrayList();
                    arrayCompanyLevelsSelectedForEdit = new ArrayList();
                    Session["arrayCategoriesSelectedForEdit"] = arrayCategoriesSelectedForEdit;
                    Session["arrayCompanyLevelsSelectedForEdit"] = arrayCompanyLevelsSelectedForEdit;

                    // Store dataset
                    Session["unitInformationTDS"] = unitInformationTDS;
                    Session["unitsChecklistRulesTemp"] = unitsChecklistRulesTemp;
                    Session["unitsServicesTemp"] = unitsServicesTemp;
                    Session["unitsInspectionsTemp"] = unitsInspectionsTemp;
                    Session["unitsNotesTemp"] = unitsNotesTemp;
                    Session["categoriesTDSForUnits"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

                // ... units_summary.aspx or units_edit.aspx
                if ((Request.QueryString["source_page"] == "units_summary.aspx") || (Request.QueryString["source_page"] == "units_edit.aspx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                    unitsChecklistRulesTemp = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesTemp"];
                    unitsServicesTemp = (UnitInformationTDS.ServiceDetailsDataTable)Session["unitsServicesTemp"];
                    unitsInspectionsTemp = (UnitInformationTDS.InspectionDetailsDataTable)Session["unitsInspectionsTemp"];
                    unitsNotesTemp = (UnitInformationTDS.NoteInformationDataTable)Session["unitsNotesTemp"];
                    categoriesTDS = (CategoriesTDS)Session["categoriesTDSForUnits"];
                    companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedUnits"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];

                        if (ViewState["update"].ToString().Trim() == "yes")
                        {
                            UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                            unitInformationUnitDetails.LoadByUnitId(unitId, companyId);

                            UnitInformationInspectionDetails unitInformationInspectionDetailsForEdit = new UnitInformationInspectionDetails(unitInformationTDS);
                            unitInformationInspectionDetailsForEdit.LoadByUnitId(unitId, companyId);

                            UnitInformationNoteDetails unitInformationNoteDetailsForEdit = new UnitInformationNoteDetails(unitInformationTDS);
                            unitInformationNoteDetailsForEdit.LoadByUnitId(unitId, companyId);

                            UnitInformationCostInformation unitInformationCostInformation = new UnitInformationCostInformation(unitInformationTDS);
                            unitInformationCostInformation.LoadAllByUnitId(unitId, companyId);

                            UnitInformationCostExceptionsInformation unitInformationCostExceptionsInformation = new UnitInformationCostExceptionsInformation(unitInformationTDS);
                            unitInformationCostExceptionsInformation.LoadAllByUnitId(unitId, companyId);

                            // Store dataset
                            Session["unitInformationTDS"] = unitInformationTDS;
                        }
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabUnits"];
                    }

                    arrayCategoriesSelectedForEdit = new ArrayList();
                    arrayCompanyLevelsSelectedForEdit = new ArrayList();
                    Session["arrayCategoriesSelectedForEdit"] = arrayCategoriesSelectedForEdit;
                    Session["arrayCompanyLevelsSelectedForEdit"] = arrayCompanyLevelsSelectedForEdit;
                }

                // ... units_add.aspx
                if (Request.QueryString["source_page"] == "units_add.aspx")
                {
                    ViewState["update"] = "yes";

                    unitInformationTDS = new UnitInformationTDS();
                    unitsChecklistRulesTemp = new UnitInformationTDS.ChecklistDetailsDataTable();
                    unitsServicesTemp = new UnitInformationTDS.ServiceDetailsDataTable();
                    unitsInspectionsTemp = new UnitInformationTDS.InspectionDetailsDataTable();
                    unitsNotesTemp = new UnitInformationTDS.NoteInformationDataTable();

                    UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                    unitInformationUnitDetails.LoadByUnitId(unitId, companyId);

                    UnitInformationNoteDetails unitInformationNoteDetailsForEdit = new UnitInformationNoteDetails(unitInformationTDS);
                    unitInformationNoteDetailsForEdit.LoadByUnitId(unitId, companyId);

                    // ... For Categories
                    categoriesTDS = new CategoriesTDS();
                    Category category = new Category(categoriesTDS);
                    category.LoadByUnitType(hdfUnitType.Value, int.Parse(hdfCompanyId.Value));

                    // .. For Company Levels
                    companyLevelsTDS = new CompanyLevelsTDS();
                    CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                    companyLevel.Load(int.Parse(hdfCompanyId.Value));

                    arrayCategoriesSelectedForEdit = new ArrayList();
                    arrayCompanyLevelsSelectedForEdit = new ArrayList();
                    Session["arrayCategoriesSelectedForEdit"] = arrayCategoriesSelectedForEdit;
                    Session["arrayCompanyLevelsSelectedForEdit"] = arrayCompanyLevelsSelectedForEdit;

                    // Store dataset
                    Session["unitInformationTDS"] = unitInformationTDS;
                    Session["unitsChecklistRulesTemp"] = unitsChecklistRulesTemp;
                    Session["unitsServicesTemp"] = unitsServicesTemp;
                    Session["unitsInspectionsTemp"] = unitsInspectionsTemp;
                    Session["unitsNotesTemp"] = unitsNotesTemp;
                    Session["categoriesTDSForUnits"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

                // ... For Library
                if (Session["libraryTDSForUnits"] != null)
                {
                    libraryTDSForUnits = (LibraryTDS)Session["libraryTDSForUnits"];
                }
                else
                {
                    libraryTDSForUnits = new LibraryTDS();
                }

                Session["costIdSelected"] = 0;
                grdCostsExceptions.ShowFooter = false;
                string filterOptions = string.Format("CostID = {0} AND Deleted = {1}", 0, 0);
                odsCostsExceptions.FilterExpression = filterOptions;

                // Set initial tab
                int activeTabUnits = Int32.Parse(hdfActiveTab.Value);
                tcDetailedInformation.ActiveTabIndex = activeTabUnits;

                // ... ... Make panels visible
                MakePanelsVisible();

                // ... ... Data for current unit
                LoadUnitData(companyId);
            }
            else
            {
                // Restore datasets
                unitInformationTDS = (UnitInformationTDS)Session["unitInformationTDS"];
                unitsChecklistRulesTemp = (UnitInformationTDS.ChecklistDetailsDataTable)Session["unitsChecklistRulesTemp"];
                unitsServicesTemp = (UnitInformationTDS.ServiceDetailsDataTable)Session["unitsServicesTemp"];
                unitsInspectionsTemp = (UnitInformationTDS.InspectionDetailsDataTable)Session["unitsInspectionsTemp"];
                unitsNotesTemp = (UnitInformationTDS.NoteInformationDataTable)Session["unitsNotesTemp"];
                categoriesTDS = (CategoriesTDS)Session["categoriesTDSForUnits"];
                companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];

                arrayCategoriesSelectedForEdit = (ArrayList)Session["arrayCategoriesSelectedForEdit"];
                arrayCompanyLevelsSelectedForEdit = (ArrayList)Session["arrayCompanyLevelsSelectedForEdit"];

                // Set initial tab
                int activeTabUnits = Int32.Parse(hdfActiveTab.Value);
                tcDetailedInformation.ActiveTabIndex = activeTabUnits;

                aceManufacturer.ContextKey = hdfCompanyId.Value;

                if (Session["libraryTDSForUnits"] != null)
                {
                    libraryTDSForUnits = (LibraryTDS)Session["libraryTDSForUnits"];
                }
                else
                {
                    libraryTDSForUnits = new LibraryTDS();
                }

                LoadNotes();
            }
        }
コード例 #8
0
        private void UpdateDatabase()
        {
            // Get ids
            int unitId = Int32.Parse(hdfUnitId.Value);
            int companyId = Int32.Parse(hdfCompanyId.Value);
            string unitType = hdfUnitType.Value;

            // Delete
            DB.Open();
            DB.BeginTransaction();
            try
            {
                UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                unitInformationUnitDetails.DeleteDirect(unitId, unitType, companyId);

                DB.CommitTransaction();
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
コード例 #9
0
        private void Delete()
        {
            Page.Validate();

            if (Page.IsValid)
            {
                // Delete
                int unitId = Int32.Parse(hdfUnitId.Value);
                int companyId = Int32.Parse(hdfCompanyId.Value);

                UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                unitInformationUnitDetails.Delete(unitId);

                UnitInformationChecklistDetails unitInformationChecklistDetails = new UnitInformationChecklistDetails(unitInformationTDS);
                unitInformationChecklistDetails.DeleteAll();

                UnitInformationInspectionDetails unitInformationInspectionDetails = new UnitInformationInspectionDetails(unitInformationTDS);
                unitInformationInspectionDetails.DeleteAll();

                UnitInformationCostExceptionsInformation unitInformationCostExceptionsInformation = new UnitInformationCostExceptionsInformation(unitInformationTDS);
                unitInformationCostExceptionsInformation.DeleteAll(unitId);

                UnitInformationCostInformation unitInformationCostInformation = new UnitInformationCostInformation(unitInformationTDS);
                unitInformationCostInformation.DeleteAll(unitId);

                // Update databse
                UpdateDatabase();

                // Store datasets
                Session["unitInformationTDS"] = unitInformationTDS;

                // Redirect
                string url = "";
                url = "./units_navigator2.aspx?source_page=units_delete.aspx" + GetNavigatorState() + "&update=yes";
                Response.Redirect(url);
            }
        }
コード例 #10
0
        private void UpdateState()
        {
            int unitId = Int32.Parse(hdfUnitId.Value);
            int companyId = Int32.Parse(hdfCompanyId.Value);

            // ... Get new values
            string unitState = null;
            string state = hdfNewUnitState.Value;

            // Operation check
            switch (state)
            {
                case "Disposed":
                    unitState = "Disposed";
                    hdfUnitState.Value = "Disposed";
                    break;

                case "Active":
                    unitState = "Active";
                    hdfUnitState.Value = "Active";
                    break;

                case "Archived":
                    unitState = "Archived";
                    hdfUnitState.Value = "Archived";
                    break;
            }

            // Update data
            UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
            unitInformationUnitDetails.UpdateState(unitId, unitState);
        }
コード例 #11
0
        private void UpdateDatabase()
        {
            int companyId = Int32.Parse(hdfCompanyId.Value);

            DB.Open();
            DB.BeginTransaction();
            try
            {
                UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS);
                unitInformationUnitDetails.SaveState(companyId, hdfNewUnitState.Value);

                DB.CommitTransaction();

                // Store datasets
                unitInformationTDS.AcceptChanges();
                Session["unitInformationTDS"] = unitInformationTDS;
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }