private void LoopRepeater()
        {
            DataSet  ds = oServiceEditor.GetFields(0);
            DataView dv = ds.Tables[0].DefaultView;

            if (Request.QueryString["sort"] != null)
            {
                dv.Sort = Request.QueryString["sort"].ToString();
            }
            rptView.DataSource = dv;
            rptView.DataBind();
            foreach (RepeaterItem ri in rptView.Items)
            {
                ImageButton oDelete = (ImageButton)ri.FindControl("btnDelete");
                oDelete.Attributes.Add("onClick", "return confirm('Are you sure you want to delete this item?');");
                ImageButton oEnable = (ImageButton)ri.FindControl("btnEnable");
                if (oEnable.ImageUrl == "/admin/images/enabled.gif")
                {
                    oEnable.ToolTip = "Click to disable";
                    oEnable.Attributes.Add("onClick", "return confirm('Are you sure you want to disable this item?');");
                }
                else
                {
                    oEnable.ToolTip = "Click to enable";
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">window.parent.navigate(window.parent.location);<" + "/" + "script>");
            }
            if (Request.QueryString["delete"] != null && Request.QueryString["delete"] != "")
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "delete", "<script type=\"text/javascript\">window.parent.navigate(window.parent.location);<" + "/" + "script>");
            }
            oServiceEditor = new ServiceEditor(intProfile, dsnServiceEditor);
            if (Request.QueryString["serviceid"] != null && Request.QueryString["serviceid"] != "")
            {
                intService = Int32.Parse(Request.QueryString["serviceid"]);
            }
            if (Request.QueryString["wm"] != null && Request.QueryString["wm"] != "")
            {
                intWMFlag = Int32.Parse(Request.QueryString["wm"]);
            }
            if (intWMFlag == 0)
            {
                panWrite.Visible = true;
            }
            if (Request.QueryString["fieldid"] != null && Request.QueryString["fieldid"] != "")
            {
                panField.Visible = true;
                intField         = Int32.Parse(Request.QueryString["fieldid"]);
                DataSet ds = oServiceEditor.GetField(intField);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblField.Text = oServiceEditor.GetField(intField, "name");
                    strCode       = oServiceEditor.GetField(intField, "code");
                    ShowPanels();
                    btnSave.Enabled = true;
                    btnSave.Text    = "Add";
                    btnBack.Visible = true;
                    btnBack.Attributes.Add("onclick", "return confirm('WARNING: Any unsaved changes will be discarded!\\n\\nAre you sure you want to continue?');");
                }
            }
            else if (Request.QueryString["configid"] != null && Request.QueryString["configid"] != "")
            {
                panField.Visible = true;
                intConfig        = Int32.Parse(Request.QueryString["configid"]);
                DataSet ds = oServiceEditor.GetConfig(intConfig);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intField      = Int32.Parse(ds.Tables[0].Rows[0]["fieldid"].ToString());
                    lblField.Text = oServiceEditor.GetField(intField, "name");
                    strCode       = oServiceEditor.GetField(intField, "code");
                    lblID.Visible = true;
                    lblID.Text    = "<b>Field ID:</b> " + ds.Tables[0].Rows[0]["dbfield"].ToString();
                    ShowPanels();
                    btnSave.Enabled   = true;
                    btnSave.Text      = "Update";
                    btnDelete.Enabled = true;
                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this control?');");
                    if (intConfig > 0 && !IsPostBack)
                    {
                        txtQuestion.Text       = ds.Tables[0].Rows[0]["question"].ToString();
                        txtURL.Text            = ds.Tables[0].Rows[0]["url"].ToString();
                        txtText.Text           = ds.Tables[0].Rows[0]["other_text"].ToString();
                        txtLength.Text         = ds.Tables[0].Rows[0]["length"].ToString();
                        txtWidth.Text          = ds.Tables[0].Rows[0]["width"].ToString();
                        txtRows.Text           = ds.Tables[0].Rows[0]["height"].ToString();
                        txtMinimum.Text        = ds.Tables[0].Rows[0]["width"].ToString();
                        txtMaximum.Text        = ds.Tables[0].Rows[0]["height"].ToString();
                        radCheckYes.Checked    = (ds.Tables[0].Rows[0]["checked"].ToString() == "1");
                        radCheckNo.Checked     = (ds.Tables[0].Rows[0]["checked"].ToString() == "0");
                        radDirectionH.Checked  = (ds.Tables[0].Rows[0]["direction"].ToString() == "1");
                        radDirectionV.Checked  = (ds.Tables[0].Rows[0]["direction"].ToString() == "0");
                        radMultipleYes.Checked = (ds.Tables[0].Rows[0]["multiple"].ToString() == "1");
                        radMultipleNo.Checked  = (ds.Tables[0].Rows[0]["multiple"].ToString() == "0");
                        if (ds.Tables[0].Rows[0]["required"].ToString() == "1")
                        {
                            radRequiredYes.Checked       = true;
                            txtRequired.Text             = ds.Tables[0].Rows[0]["required_text"].ToString();
                            divRequired.Style["display"] = "inline";
                        }
                        else
                        {
                            radRequiredNo.Checked = true;
                        }
                        txtTip.Text      = ds.Tables[0].Rows[0]["tip"].ToString();
                        chkWrite.Checked = (ds.Tables[0].Rows[0]["wm"].ToString() == "1");
                        chkWrite.ToolTip = ds.Tables[0].Rows[0]["wm"].ToString();
                        ds = oServiceEditor.GetConfigValues(intConfig);
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            lstValues.Items.Add(dr["value"].ToString());
                            hdnValues.Value += dr["value"].ToString() + ";";
                        }
                    }
                }
            }
            else
            {
                panFields.Visible = true;
                DataSet       ds = oServiceEditor.GetFields(1);
                StringBuilder sb = new StringBuilder(strFields);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (sb.ToString() != "")
                    {
                        sb.Append("<tr><td colspan=\"2\"><span style=\"width:100%;border-bottom:1 dotted #CCCCCC;\"/></td></tr>");
                    }

                    sb.Append("<tr><td class=\"header\">");
                    sb.Append(dr["name"].ToString());
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td>");
                    sb.Append(dr["description"].ToString());
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td class=\"required\"><a href=\"javascript:void(0);\" onclick=\"ShowHideDivExample('TR");
                    sb.Append(dr["id"].ToString());
                    sb.Append("',this);\">Show Example</a></td></tr>");
                    sb.Append("<tr id=\"TR");
                    sb.Append(dr["id"].ToString());
                    sb.Append("\" style=\"display:none\"><td><img src=\"");
                    sb.Append(dr["image"].ToString());
                    sb.Append("\" border=\"0\"/></td></tr>");
                    sb.Append("<tr><td><input type=\"button\" value=\"Add to Form\" class=\"default\" onclick=\"window.navigate('");
                    sb.Append(Request.Path);
                    sb.Append("?wm=");
                    sb.Append(intWMFlag.ToString());
                    sb.Append("&serviceid=");
                    sb.Append(intService.ToString());
                    sb.Append("&fieldid=");
                    sb.Append(dr["id"].ToString());
                    sb.Append("');\" style=\"width:100px\"/></td></tr>");
                }

                if (sb.ToString() != "")
                {
                    sb.Insert(0, "<table height=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"3\">");
                    sb.Append("</table>");
                }

                strFields = sb.ToString();
            }
            if (txtMinimum.Text == "")
            {
                txtMinimum.Text = "0";
            }
            if (txtMaximum.Text == "")
            {
                txtMaximum.Text = "0";
            }
            radRequiredYes.Attributes.Add("onclick", "ShowHideDiv('" + divRequired.ClientID + "','inline');");
            radRequiredNo.Attributes.Add("onclick", "ShowHideDiv('" + divRequired.ClientID + "','none');");
            txtAdd.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnAdd.ClientID + "').click();return false;}} else {return true}; ");
            btnUp.Attributes.Add("onclick", "return MoveOrderUp(" + lstValues.ClientID + ",'" + hdnValues.ClientID + "');");
            btnOut.Attributes.Add("onclick", "return MoveOrderOut(" + lstValues.ClientID + ",'" + hdnValues.ClientID + "');");
            btnDown.Attributes.Add("onclick", "return MoveOrderDown(" + lstValues.ClientID + ",'" + hdnValues.ClientID + "');");
            btnAdd.Attributes.Add("onclick", "return ValidateText('" + txtAdd.ClientID + "','Please enter a value') && ValidateNoComma('" + txtAdd.ClientID + "','The value cannot contain a comma (,)\\n\\nPlease click OK and remove all commas from the value field') && ValidateNoDuplicate('" + txtAdd.ClientID + "','" + lstValues.ClientID + "','This value already exists. You cannot add the same value more than once.\\n\\nPlease change the value and try again.') && MoveOrderIn(" + lstValues.ClientID + ",'" + hdnValues.ClientID + "','" + txtAdd.ClientID + "');");
        }
Пример #3
0
        private void LoadList()
        {
            string strBind = "";

            if (lblType.Text == "PLAT")
            {
                ds = oPlatform.Gets(1);
                lstOrder.DataValueField = "platformid";
            }
            if (lblType.Text == "ORG")
            {
                ds = oOrganization.Gets(1);
                lstOrder.DataValueField = "organizationid";
            }
            if (lblType.Text == "COST")
            {
                ds = oCost.Gets(1);
                lstOrder.DataValueField = "costid";
            }
            if (lblType.Text == "AT")
            {
                ds = oUserAt.Gets(1);
                lstOrder.DataValueField = "atid";
            }
            if (lblType.Text == "ITEMS")
            {
                ds = oRequestItem.GetItems(Int32.Parse(lblId.Text), 0, 1);
                lstOrder.DataValueField = "itemid";
            }
            if (lblType.Text == "SERVICEDETAIL")
            {
                ds = oServiceDetail.Gets(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVICES")
            {
                int intFolder = Int32.Parse(oService.GetFolders(Int32.Parse(lblId.Text), "folderid"));
                ds = oService.Gets(intFolder, 1, 1, 1, 0);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVICE_FOLDERS")
            {
                ds = oService.GetFolders(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "REPORTS")
            {
                ds = oReport.Gets(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "reportid";
                strBind = "title";
            }
            if (lblType.Text == "A_SITE")
            {
                ds = oSites.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_TYPE")
            {
                ds = oType.Gets(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_MODEL")
            {
                ds = oModel.Gets(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_LOCATION_S")
            {
                ds = oDepot.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_SHELF")
            {
                ds = oShelf.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_RACK")
            {
                ds = oRacks.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "CLASS")
            {
                ds = oClasses.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_ROOM")
            {
                ds = oRooms.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "A_FLOOR")
            {
                ds = oFloor.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ENVIRONMENT")
            {
                ds = oEnvironment.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "S_CODE")
            {
                ds = oSolution.GetCodes(1);
                lstOrder.DataValueField = "id";
                strBind = "code";
            }
            if (lblType.Text == "F_QUESTION")
            {
                ds = oForecast.GetQuestions(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "F_RESPONSE")
            {
                ds = oForecast.GetResponses(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "F_LINE_ITEMS")
            {
                ds = oForecast.GetLineItems(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "CONFIDENCE")
            {
                ds = oConfidence.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "LOCATION_S")
            {
                ds = oLocation.GetStates(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "F_STEPS")
            {
                ds = oForecast.GetSteps(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "F_STEPS_ADD")
            {
                ds = oForecast.GetStepAdditionals(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "FIELD")
            {
                ds = oField.Gets(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
                strBind = "fieldname";
            }
            if (lblType.Text == "DOMAIN_CONTROLLER")
            {
                ds = oDomainController.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "DOMAIN")
            {
                ds = oDomain.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVERNAME_A")
            {
                ds = oServerName.GetApplications(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVERNAME_SUBA")
            {
                ds = oServerName.GetSubApplications(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVERNAME_C")
            {
                ds = oServerName.GetComponents(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "WORKSTATION_C")
            {
                ds = oWorkstation.GetComponents(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "OPERATING_SYSTEM")
            {
                ds = oOperatingSystems.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "OD_W_STEPS")
            {
                ds = oOnDemand.GetWizardSteps(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "OD_STEPS")
            {
                ds = oOnDemand.GetSteps(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVICE_PACK")
            {
                ds = oServicePack.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "COMPONENT_SCRIPTS")
            {
                ds = oServerName.GetComponentDetailScripts(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "HOST")
            {
                ds = oHost.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "VIRTUAL_HDD")
            {
                ds = oVirtualHDD.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "VIRTUAL_RAM")
            {
                ds = oVirtualRam.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "RESTART")
            {
                ds = oRestart.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SEGMENT")
            {
                ds = oSegment.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "DOMAIN_SUFFIX")
            {
                ds = oDomain.GetSuffixs(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "DOMAIN_ADMIN_GROUP")
            {
                ds = oDomain.GetAdminGroups(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SERVICE_EDITOR_FIELDS")
            {
                ds = oServiceEditor.GetFields(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "PROJECT_REQUEST_QUESTION")
            {
                ds = oProjectRequest.GetQuestions(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "PROJECT_REQUEST_RESPONSE")
            {
                ds = oProjectRequest.GetResponses(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "PROJECT_REQUEST_CLASS")
            {
                ds = oProjectRequest.GetClasses(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "VMWARE_TEMPLATE")
            {
                ds = oVMWare.GetTemplates(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ORDER_REPORT_DATASOURCE")
            {
                ds = oReport.GetDataSources(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ORDER_REPORT_CHARTS")
            {
                ds = oReport.GetCharts(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "PLATFORM_FORM")
            {
                ds = oPlatform.GetForms(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            //if (lblType.Text == "NEW")
            //{
            //    ds = oNew.Gets(1);
            //    lstOrder.DataValueField = "id";
            //    strBind = "title";
            //}
            if (lblType.Text == "WHATSNEW")
            {
                ds = oWhatsNew.Gets(1);
                lstOrder.DataValueField = "id";
                strBind = "title";
            }
            //if (lblType.Text == "RECOVERY_LOCATIONS")
            //{
            //    ds = oRecoveryLocations.Gets(1);
            //    lstOrder.DataValueField = "id";
            //}
            if (lblType.Text == "MAINTENANCE_WINDOW")
            {
                ds = oMaintenanceWindow.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "TSM")
            {
                ds = oTSM.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "TSM_DOMAINS")
            {
                ds = oTSM.GetDomains(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "TSM_SCHEDULES")
            {
                ds = oTSM.GetSchedules(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "DNS")
            {
                ds = oDNS.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SOLARIS_BUILD_NETWORKS")
            {
                ds = oSolaris.GetBuildNetworks(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SOLARIS_BUILD_TYPES")
            {
                ds = oSolaris.GetBuildTypes(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "SOLARIS_INTERFACES")
            {
                ds = oSolaris.GetInterfaces(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ZEUS_ARRAY_CONFIGS")
            {
                ds = oZeus.GetArrayConfigs(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ZEUS_BUILD_TYPES")
            {
                ds = oZeus.GetBuildTypes(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ERROR_TYPES")
            {
                ds = oError.GetTypes(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ERROR_TYPES_TYPES")
            {
                ds = oError.GetTypeTypes(Int32.Parse(lblId.Text), 1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "D_PHASES")
            {
                ds      = oDesign.GetPhases(1);
                strBind = "title";
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "D_QUESTIONS")
            {
                ds      = oDesign.GetQuestions(Int32.Parse(lblId.Text), 1);
                strBind = "summary";
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "D_RESPONSES")
            {
                ds      = oDesign.GetResponses(Int32.Parse(lblId.Text), 0, 1);
                strBind = "admin";
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "D_MODELS")
            {
                ds = oDesign.GetModels(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "RESILIENCY")
            {
                ds = oResiliency.Gets(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "ENHANCEMENT_MODULES")
            {
                ds = oEnhancement.GetModules(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "OPERATING_SYSTEM_GROUPS")
            {
                ds = oOperatingSystems.GetGroups(1);
                lstOrder.DataValueField = "id";
            }
            if (lblType.Text == "DESIGN_APPROVE_CONDITION")
            {
                ds = oDesign.GetApprovalConditionals(1);
                lstOrder.DataValueField = "id";
            }



            if (strBind == "")
            {
                strBind = "name";
            }
            lstOrder.DataTextField = strBind;
            lstOrder.DataSource    = ds;
            lstOrder.DataBind();
        }