コード例 #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"]) || 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;
            }
        }
コード例 #2
0
        private bool StepTypeNext()
        {
            Category category = new Category(categoriesTDS);

            if (rbtnVehicle.Checked)
            {
                category.LoadByUnitType("Vehicle", int.Parse(hdfCompanyId.Value));
            }
            else
            {
                category.LoadByUnitType("Equipment", int.Parse(hdfCompanyId.Value));
            }

            Session["categoriesTDSForUnitsAdd"] = categoriesTDS;

            tvCategoriesRoot.Nodes.Clear();
            GetNodeForCategory(tvCategoriesRoot.Nodes, 0);

            return true;
        }
コード例 #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_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();
            }
        }
コード例 #4
0
        protected void grdConditions_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                int conditionId = 0; conditionId = int.Parse(((DropDownList)e.Row.FindControl("ddlName")).SelectedValue);
                DropDownList ddlOperator = ((DropDownList)e.Row.FindControl("ddlOperator"));

                if (conditionId > 0)
                {
                    DropDownList ddlConditionNumber = ((DropDownList)e.Row.FindControl("ddlConditionNumber"));

                    FmViewTDS dataSet = new FmViewTDS();
                    dataSet.FmViewConditionNew.Merge(fmViewConditionNew, true);
                    FmViewConditionNew model = new FmViewConditionNew(dataSet);
                    int conditionNumber = model.GetNewConditionNumber();
                    ddlConditionNumber.SelectedValue = conditionNumber.ToString();

                    FmTypeViewConditionGateway fmTypeViewConditionGateway = new FmTypeViewConditionGateway();
                    fmTypeViewConditionGateway.LoadByFmTypeConditionId(hdfFmType.Value, int.Parse(hdfCompanyId.Value), conditionId);
                    string type = fmTypeViewConditionGateway.GetType(hdfFmType.Value, int.Parse(hdfCompanyId.Value), conditionId);

                    if (ddlOperator.SelectedItem == null)
                    {
                        FmTypeViewOperatorList fmTypeViewOperatorList = new FmTypeViewOperatorList(new DataSet());
                        fmTypeViewOperatorList.LoadAndAddItem(type, Int32.Parse(hdfCompanyId.Value));
                        ddlOperator.DataSource = fmTypeViewOperatorList.Table;
                        ddlOperator.DataValueField = "Sign";
                        ddlOperator.DataTextField = "Operator";
                        ddlOperator.DataBind();
                        ddlOperator.SelectedIndex = 0;
                    }

                    if ((type == "String") || (type == "Date") || (type == "Int") || (type == "Decimal"))
                    {
                        ddlOperator.Enabled = true;

                        TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                        tbxValue.Visible = true;

                        DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                        ddlValue.Visible = false;

                        RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                        rbtnYes.Visible = false;

                        RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                        rbtnNo.Visible = false;
                    }

                    if ((type == "FixedItems") || (type == "DynamicItems") || (type == "Boolean"))
                    {
                        ddlOperator.Enabled = false;

                        if (type == "FixedItems")
                        {
                            DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                            ddlValue.Visible = true;

                            TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                            tbxValue.Visible = false;

                            RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                            rbtnYes.Visible = false;

                            RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                            rbtnNo.Visible = false;
                        }

                        if (type == "DynamicItems")
                        {
                            DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                            ddlValue.Visible = true;

                            TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                            tbxValue.Visible = false;

                            RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                            rbtnYes.Visible = false;

                            RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                            rbtnNo.Visible = false;
                        }

                        if (type == "Boolean")
                        {
                            DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                            ddlValue.Visible = false;

                            TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                            tbxValue.Visible = false;

                            RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                            rbtnYes.Visible = true;

                            RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                            rbtnNo.Visible = true;
                        }
                    }
                }
            }

            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                FmViewTDS dataSet = new FmViewTDS();
                dataSet.FmViewConditionNew.Merge(fmViewConditionNew, true);
                FmViewConditionNewGateway gateway = new FmViewConditionNewGateway(dataSet);
                int id = int.Parse(((Label)e.Row.FindControl("lblId")).Text);

                int conditionId = gateway.GetConditionId(id);
                DropDownList ddlName = ((DropDownList)e.Row.FindControl("ddlName"));
                DropDownList ddlOperator = ((DropDownList)e.Row.FindControl("ddlOperator"));

                if (conditionId > 0)
                {
                    FmTypeViewConditionGateway fmTypeViewConditionGateway = new FmTypeViewConditionGateway();
                    fmTypeViewConditionGateway.LoadByFmTypeConditionId(hdfFmType.Value, int.Parse(hdfCompanyId.Value), conditionId);
                    string type = fmTypeViewConditionGateway.GetType(hdfFmType.Value, int.Parse(hdfCompanyId.Value), conditionId);

                    ddlName.DataBind();
                    ddlName.SelectedValue = conditionId.ToString();

                    FmTypeViewOperatorList fmTypeViewOperatorList = new FmTypeViewOperatorList(new DataSet());
                    fmTypeViewOperatorList.LoadAndAddItem(type, Int32.Parse(hdfCompanyId.Value));
                    ddlOperator.DataSource = fmTypeViewOperatorList.Table;
                    ddlOperator.DataValueField = "Sign";
                    ddlOperator.DataTextField = "Operator";
                    ddlOperator.DataBind();
                    ddlOperator.SelectedValue = gateway.GetSign(id);

                    if ((type == "String") || (type == "Date") || (type == "Int") || (type == "Decimal") || (type == "Distance"))
                    {
                        ddlOperator.Enabled = true;

                        TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                        tbxValue.Visible = true;
                        tbxValue.Text = gateway.GetValue_(id);

                        DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                        ddlValue.Visible = false;

                        RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                        rbtnYes.Visible = false;

                        RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                        rbtnNo.Visible = false;
                    }

                    if ((type == "FixedItems") || (type == "DynamicItems") || (type == "Boolean"))
                    {
                        ddlOperator.Enabled = false;

                        if (type == "FixedItems")
                        {
                            DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                            ddlValue.Visible = true;

                            // Prepare initial data
                            // ... For view type
                            FmTypeViewConditionItemList fmTypeViewConditionItemList = new FmTypeViewConditionItemList(new DataSet());
                            fmTypeViewConditionItemList.LoadAndAddItemInView(hdfFmType.Value, Int32.Parse(hdfCompanyId.Value), conditionId);
                            ddlValue.DataSource = fmTypeViewConditionItemList.Table;
                            ddlValue.DataValueField = "Name";
                            ddlValue.DataTextField = "Name";
                            ddlValue.DataBind();
                            ddlValue.SelectedValue = gateway.GetValue_(id);

                            TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                            tbxValue.Visible = false;

                            RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                            rbtnYes.Visible = false;

                            RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                            rbtnNo.Visible = false;
                        }

                        if (type == "DynamicItems")
                        {
                            DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                            ddlValue.Visible = true;

                            // Prepare initial data
                            // ... For view type
                            if (ddlName.SelectedItem.Text == "Category")
                            {
                                //Category for Units
                                Category category = new Category(categoriesTDS);
                                category.LoadAllUnitTypes(Int32.Parse(hdfCompanyId.Value));

                                Session["categoriesTDSForAddView"] = categoriesTDS;

                                if (category.Table.Rows.Count > 0)
                                {
                                    GetNodeForCategory(0, ddlValue);//Equipments
                                    level = -1;
                                    GetNodeForCategory(-1, ddlValue);//Vehicles

                                    ddlValue.DataBind();
                                    string categorySelected = gateway.GetValue_(id);

                                    foreach (ListItem li in ddlValue.Items)
                                    {
                                        if (li.Text.Contains(categorySelected))
                                        {
                                            li.Selected = true;
                                        }
                                    }
                                }
                                else
                                {
                                    ddlValue.Visible = false;
                                }
                            }
                            else
                            {
                                //State for Services
                                FmTypeViewStateList fmTypeViewStateList = new FmTypeViewStateList(new DataSet());
                                fmTypeViewStateList.LoadAndAddItem(Int32.Parse(hdfCompanyId.Value));

                                if (fmTypeViewStateList.Table.Rows.Count > 0)
                                {
                                    ddlValue.DataSource = fmTypeViewStateList.Table;
                                    ddlValue.DataValueField = "State";
                                    ddlValue.DataTextField = "State";
                                    ddlValue.DataBind();
                                    ddlValue.SelectedValue = gateway.GetValue_(id);
                                }
                                else
                                {
                                    ddlValue.Visible = false;
                                }
                            }

                            TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                            tbxValue.Visible = false;

                            RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                            rbtnYes.Visible = false;

                            RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                            rbtnNo.Visible = false;
                        }

                        if (type == "Boolean")
                        {
                            DropDownList ddlValue = ((DropDownList)e.Row.FindControl("ddlValue"));
                            ddlValue.Visible = false;

                            TextBox tbxValue = ((TextBox)e.Row.FindControl("tbxValue"));
                            tbxValue.Visible = false;

                            RadioButton rbtnYes = ((RadioButton)e.Row.FindControl("rbtnYes"));
                            rbtnYes.Visible = true;

                            RadioButton rbtnNo = ((RadioButton)e.Row.FindControl("rbtnNo"));
                            rbtnNo.Visible = true;

                            if (gateway.GetValue_(id) == "Yes")
                            {
                                rbtnYes.Checked = true;
                            }
                            else
                            {
                                rbtnNo.Checked = true;
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        // ////////////////////////////////////////////////////////////////////////
        // INITIAL EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

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

                // Tag page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfUpdate.Value = "no";

                // Initialize viewstate variables
                ViewState["StepFrom"] = "Out";

                // Prepare initial data
                checklistRulesAddTDS = new ChecklistRulesAddTDS();
                Session["checklistRulesAddTDS"] = checklistRulesAddTDS;

                arrayCategoriesSelected = new ArrayList();
                arrayCompanyLevelsSelected = new ArrayList();
                arrayUnitsSelected = new ArrayList();
                Session["arrayCategoriesSelected"] = arrayCategoriesSelected;
                Session["arrayCompanyLevelsSelected"] = arrayCompanyLevelsSelected;
                Session["arrayUnitsSelected"] = arrayUnitsSelected;

                // ... for frecuency
                RuleFrecuencyList ruleFrecuency = new RuleFrecuencyList();
                ruleFrecuency.LoadAndAddItem("(Select a frequency)", int.Parse(hdfCompanyId.Value));
                ddlFrequency.DataSource = ruleFrecuency.Table;
                ddlFrequency.DataValueField = "Frequency";
                ddlFrequency.DataTextField = "Frequency";
                ddlFrequency.DataBind();

                // ... for Categories
                categoriesTDS = new CategoriesTDS();
                Category category = new Category(categoriesTDS);
                category.Load(int.Parse(hdfCompanyId.Value));
                GetNodeForCategory(tvCategoriesRoot.Nodes, 0);

                // .. for Company Levels
                companyLevelsTDS = new CompanyLevelsTDS();
                CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                companyLevel.Load(int.Parse(hdfCompanyId.Value));
                GetNodeForCompanyLevels(tvCompanyLevelsRoot.Nodes, 0);

                StepGeneralInformationIn();
            }
            else
            {
                checklistRulesAddTDS = (ChecklistRulesAddTDS)Session["checklistRulesAddTDS"];
                arrayCategoriesSelected = (ArrayList)Session["arrayCategoriesSelected"];
                arrayCompanyLevelsSelected = (ArrayList)Session["arrayCompanyLevelsSelected"];
                arrayUnitsSelected = (ArrayList)Session["arrayUnitsSelected"];
            }
        }
コード例 #6
0
        protected void ddlName_SelectedIndexChanged(object sender, EventArgs e)
        {
            Label lblValidateValue = ((Label)grdConditions.Rows[grdConditions.EditIndex].FindControl("lblValidateValue"));
            lblValidateValue.Visible = false;

            ImageButton ibtnAdd = ((ImageButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("ibtnAccept"));
            ibtnAdd.Visible = true;

            DropDownList ddlName = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlName"));
            DropDownList ddlOperator = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlOperator"));

            FmTypeViewConditionGateway fmTypeViewConditionGateway = new FmTypeViewConditionGateway();
            fmTypeViewConditionGateway.LoadByFmTypeConditionId(hdfFmType.Value, int.Parse(hdfCompanyId.Value), int.Parse(ddlName.SelectedValue));
            string type = fmTypeViewConditionGateway.GetType(hdfFmType.Value, int.Parse(hdfCompanyId.Value), int.Parse(ddlName.SelectedValue));
            int index = grdConditions.SelectedIndex;

            FmTypeViewOperatorList fmTypeViewOperatorList = new FmTypeViewOperatorList(new DataSet());
            fmTypeViewOperatorList.LoadAndAddItem(type, Int32.Parse(hdfCompanyId.Value));
            ddlOperator.DataSource = fmTypeViewOperatorList.Table;
            ddlOperator.DataValueField = "Sign";
            ddlOperator.DataTextField = "Operator";
            ddlOperator.DataBind();
            ddlOperator.SelectedIndex = 0;

            if ((type == "String") || (type == "Date") || (type == "Int") || (type == "Decimal") || (type == "Distance"))
            {
                ddlOperator.Enabled = true;

                TextBox tbxValue = ((TextBox)grdConditions.Rows[grdConditions.EditIndex].FindControl("tbxValue"));
                tbxValue.Visible = true;

                DropDownList ddlValue = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlValue"));
                ddlValue.Visible = false;

                RadioButton rbtnYes = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnYes"));
                rbtnYes.Visible = false;

                RadioButton rbtnNo = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnNo"));
                rbtnNo.Visible = false;
            }

            if ((type == "FixedItems") || (type == "DynamicItems") || (type == "Boolean"))
            {
                ddlOperator.Enabled = false;

                if (type == "FixedItems")
                {
                    DropDownList ddlValue = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlValue"));
                    ddlValue.Visible = true;

                    // Prepare initial data
                    // ... For view type
                    FmTypeViewConditionItemList fmTypeViewConditionItemList = new FmTypeViewConditionItemList(new DataSet());
                    fmTypeViewConditionItemList.LoadAndAddItemInView(hdfFmType.Value, Int32.Parse(hdfCompanyId.Value), int.Parse(ddlName.SelectedValue));
                    ddlValue.DataSource = fmTypeViewConditionItemList.Table;
                    ddlValue.DataValueField = "Name";
                    ddlValue.DataTextField = "Name";
                    ddlValue.DataBind();
                    ddlValue.SelectedIndex = 0;

                    TextBox tbxValue = ((TextBox)grdConditions.Rows[grdConditions.EditIndex].FindControl("tbxValue"));
                    tbxValue.Visible = false;

                    RadioButton rbtnYes = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnYes"));
                    rbtnYes.Visible = false;

                    RadioButton rbtnNo = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnNo"));
                    rbtnNo.Visible = false;
                }

                if (type == "DynamicItems")
                {
                    DropDownList ddlValue = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlValue"));

                    // Prepare initial data
                    // ... For view type
                    if (ddlName.SelectedItem.Text == "Category")
                    {//Category for Units
                        Category category = new Category(categoriesTDS);
                        category.LoadAllUnitTypes(Int32.Parse(hdfCompanyId.Value));

                        Session["categoriesTDSForAddView"] = categoriesTDS;

                        if (category.Table.Rows.Count > 0)
                        {
                            GetNodeForCategory(0, ddlValue);//Equipments
                            level = -1;
                            GetNodeForCategory(-1, ddlValue);//Vehicles

                            ddlValue.DataBind();
                            ddlValue.SelectedIndex = 0;

                            ibtnAdd.Visible = true;
                        }
                        else
                        {
                            ddlValue.Visible = false;
                            ibtnAdd.Visible = false;

                            lblValidateValue.Visible = true;
                        }
                    }
                    else
                    {
                        //State for Services
                        FmTypeViewStateList fmTypeViewStateList = new FmTypeViewStateList(new DataSet());
                        fmTypeViewStateList.LoadAndAddItem(Int32.Parse(hdfCompanyId.Value));

                        if (fmTypeViewStateList.Table.Rows.Count > 0)
                        {
                            ddlValue.DataSource = fmTypeViewStateList.Table;
                            ddlValue.DataValueField = "State";
                            ddlValue.DataTextField = "State";
                            ddlValue.DataBind();
                            ddlValue.SelectedIndex = 0;

                            ibtnAdd.Visible = true;
                        }
                        else
                        {
                            ddlValue.Visible = false;
                            ibtnAdd.Visible = false;

                            lblValidateValue.Visible = true;
                        }
                    }

                    TextBox tbxValue = ((TextBox)grdConditions.Rows[grdConditions.EditIndex].FindControl("tbxValue"));
                    tbxValue.Visible = false;

                    RadioButton rbtnYes = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnYes"));
                    rbtnYes.Visible = false;

                    RadioButton rbtnNo = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnNo"));
                    rbtnNo.Visible = false;
                }

                if (type == "Boolean")
                {
                    DropDownList ddlValue = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlValue"));
                    ddlValue.Visible = false;

                    TextBox tbxValue = ((TextBox)grdConditions.Rows[grdConditions.EditIndex].FindControl("tbxValue"));
                    tbxValue.Visible = false;

                    RadioButton rbtnYes = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnYes"));
                    rbtnYes.Visible = true;

                    RadioButton rbtnNo = ((RadioButton)grdConditions.Rows[grdConditions.EditIndex].FindControl("rbtnNo"));
                    rbtnNo.Visible = true;
                }
            }
        }
コード例 #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_CHECKLISTRULES_VIEW"]) && Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_CHECKLISTRULES_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["rule_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in checklist_rules_summary.aspx");
                }

                // If coming from
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfRuleId.Value = Request.QueryString["rule_id"].ToString();
                arrayCategoriesSelected = new ArrayList();
                arrayCompanyLevelsSelected = new ArrayList();

                int companyId = Int32.Parse(hdfCompanyId.Value);
                int ruleId = Int32.Parse(hdfRuleId.Value);

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

                    // ... For rule
                    ruleTDS = new RuleTDS();
                    LiquiForce.LFSLive.BL.FleetManagement.ChecklistRules.Rule rule = new LiquiForce.LFSLive.BL.FleetManagement.ChecklistRules.Rule(ruleTDS);
                    rule.LoadByRuleId(ruleId, companyId);

                    // ... For Categories
                    categoriesTDS = new CategoriesTDS();
                    Category category = new Category(categoriesTDS);
                    category.Load(companyId);

                    // .. For Company Levels
                    companyLevelsTDS = new CompanyLevelsTDS();
                    CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                    companyLevel.Load(companyId);

                    // Store dataset
                    Session["ruleTDS"] = ruleTDS;
                    Session["categoriesTDSForChecklist"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

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

                    // ... For rule
                    ruleTDS = new RuleTDS();
                    LiquiForce.LFSLive.BL.FleetManagement.ChecklistRules.Rule rule = new LiquiForce.LFSLive.BL.FleetManagement.ChecklistRules.Rule(ruleTDS);
                    rule.LoadByRuleId(ruleId, companyId);

                    // ... For Categories
                    categoriesTDS = new CategoriesTDS();
                    Category category = new Category(categoriesTDS);
                    category.Load(companyId);

                    // ... For Company Levels
                    companyLevelsTDS = new CompanyLevelsTDS();
                    CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                    companyLevel.Load(companyId);

                    // Store dataset
                    Session["ruleTDS"] = ruleTDS;
                    Session["categoriesTDSForChecklist"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

                // ... checklist_rules_delete.aspx or checklist_rules_edit.aspx
                if ((Request.QueryString["source_page"] == "checklist_rules_delete.aspx") || (Request.QueryString["source_page"] == "checklist_rules_edit.aspx"))
                {
                    ViewState["update"] = Request.QueryString["update"];

                    // ... For rule
                    ruleTDS = new RuleTDS();
                    LiquiForce.LFSLive.BL.FleetManagement.ChecklistRules.Rule rule = new LiquiForce.LFSLive.BL.FleetManagement.ChecklistRules.Rule(ruleTDS);
                    rule.LoadByRuleId(ruleId, companyId);

                    // ... For Categories
                    categoriesTDS = new CategoriesTDS();
                    Category category = new Category(categoriesTDS);
                    category.Load(companyId);

                    // ... For Company Levels
                    companyLevelsTDS = new CompanyLevelsTDS();
                    CompanyLevel companyLevel = new CompanyLevel(companyLevelsTDS);
                    companyLevel.Load(companyId);

                    // Store dataset
                    Session["ruleTDS"] = ruleTDS;
                    Session["categoriesTDSForChecklist"] = categoriesTDS;
                    Session["companyLevelsTDS"] = companyLevelsTDS;
                }

                // Load Data for current rule
                LoadData(ruleId);

                // Databind
                Page.DataBind();
            }
            else
            {
                // Restore datasets
                ruleTDS = (RuleTDS)Session["ruleTDS"];
                categoriesTDS = (CategoriesTDS)Session["categoriesTDSForChecklist"];
                companyLevelsTDS = (CompanyLevelsTDS)Session["companyLevelsTDS"];
            }
        }
コード例 #8
0
 /// <summary>
 /// UpdateCategory
 /// </summary>
 /// <param name="originalCategoryId">originalCategoryId</param>
 /// <param name="originalType">originalType</param>
 /// <param name="originalName">originalName</param>
 /// <param name="originalParentId">originalParentId</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// <param name="newCategoryId">newCategoryId</param>
 /// <param name="newType">newType</param>
 /// <param name="newName">newName</param>
 /// <param name="newParentId">newParentId</param>
 /// <param name="newDeleted">newDeleted</param>
 /// <param name="newCompanyId">newCompanyId</param>
 private void UpdateCategory(int originalCategoryId, string originalType, string originalName, int? originalParentId, bool originalDeleted, int originalCompanyId, int newCategoryId, string newType, string newName, int? newParentId, bool newDeleted, int newCompanyId)
 {
     Category category = new Category(null);
     category.UpdateDirect(originalCategoryId, originalType, originalName, originalParentId, originalDeleted, originalCompanyId, newCategoryId, newType, newName, newParentId, newDeleted, newCompanyId);
 }
コード例 #9
0
 /// <summary>
 /// InsertCategory
 /// </summary>
 /// <param name="type">type</param>
 /// <param name="name">name</param>
 /// <param name="parentId">parentId</param>
 /// <param name="deleted">deleted</param>
 /// <param name="companyId">companyId</param>
 private void InsertCategory(string type, string name, int? parentId, bool deleted, int companyId)
 {
     Category categories = new Category(null);
     categories.InsertDirect(type, name, parentId, deleted, companyId);
 }
コード例 #10
0
 /// <summary>
 /// DeleteCategory
 /// </summary>
 /// <param name="categoryId">categoryId</param>
 /// <param name="companyId">companyId</param>
 private void DeleteCategory(int categoryId, int companyId)
 {
     Category category = new Category(null);
     category.DeletedDirect(categoryId, companyId);
 }