Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title        = "ClearView Application Information";
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oVariable         = new Variables(intEnvironment);
            oClass            = new Classes(intProfile, dsn);
            oMnemonic         = new Mnemonic(intProfile, dsn);
            oCostCenter       = new CostCenter(intProfile, dsn);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID = Int32.Parse(Request.QueryString["id"]);
            }
            if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
            {
                intStep = Int32.Parse(Request.QueryString["sid"]);
            }
            if (oForecast.GetAnswer(intID, "completed") == "" && Request.QueryString["view"] == null)
            {
                if (Request.QueryString["step"] != null && Request.QueryString["step"] != "")
                {
                    panUpdate.Visible = true;
                }
                else
                {
                    panNavigation.Visible = true;
                }
            }
            else
            {
                btnClose.Text = "Close";
            }
            string strPNC   = "";
            int    intClass = 0;

            if (intID > 0)
            {
                Page.Title = "ClearView Application Information | Design # " + intID.ToString();
                DataSet ds = oForecast.GetAnswer(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intRequest   = oForecast.GetRequestID(intID, true);
                    txtName.Text = ds.Tables[0].Rows[0]["appname"].ToString();
                    intClass     = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                    if (oClass.Get(intClass, "pnc") == "1")
                    {
                        boolPNC = true;
                    }
                    if (boolPNC == true)
                    {
                        panMnemonic.Visible = true;
                        strPNC = " && ValidateHidden0('" + hdnMnemonic.ClientID + "','" + txtMnemonic.ClientID + "','Please enter the mnemonic of this design\\n\\n(Start typing and a list will be presented...)')";
                        int intMnemonic = Int32.Parse(ds.Tables[0].Rows[0]["mnemonicid"].ToString());
                        if (intMnemonic > 0)
                        {
                            txtMnemonic.Text = oMnemonic.Get(intMnemonic, "factory_code") + " - " + oMnemonic.Get(intMnemonic, "name");
                        }
                        hdnMnemonic.Value = intMnemonic.ToString();

                        int intCostCenter = 0;
                        if (boolUseCostCenter == true)
                        {
                            panCostCenter.Visible = true;
                            strPNC = " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center of this design\\n\\n(Start typing and a list will be presented...)')";
                            if (Int32.TryParse(ds.Tables[0].Rows[0]["costcenterid"].ToString(), out intCostCenter) == true)
                            {
                                txtCostCenter.Text = oCostCenter.GetName(intCostCenter);
                            }
                        }
                        hdnCostCenter.Value = intCostCenter.ToString();
                    }
                    else
                    {
                        panCode.Visible = true;
                        strPNC          = " && ValidateText('" + txtCode.ClientID + "','Please enter an application code')";
                        txtCode.Text    = ds.Tables[0].Rows[0]["appcode"].ToString();
                    }
                    int intDR = Int32.Parse(ds.Tables[0].Rows[0]["dr_criticality"].ToString());
                    if (intDR == 1)
                    {
                        radHigh.Checked = true;
                    }
                    if (intDR == 2)
                    {
                        radLow.Checked = true;
                    }
                    int intOwner     = Int32.Parse(ds.Tables[0].Rows[0]["appcontact"].ToString());
                    int intPrimary   = Int32.Parse(ds.Tables[0].Rows[0]["admin1"].ToString());
                    int intSecondary = Int32.Parse(ds.Tables[0].Rows[0]["admin2"].ToString());
                    int intAppOwner  = Int32.Parse(ds.Tables[0].Rows[0]["appowner"].ToString());
                    int intEngineer  = Int32.Parse(ds.Tables[0].Rows[0]["networkengineer"].ToString());
                    if (intOwner > 0)
                    {
                        txtOwner.Text = oUser.GetFullName(intOwner) + " (" + oUser.GetName(intOwner) + ")";
                    }
                    if (intPrimary > 0)
                    {
                        txtPrimary.Text = oUser.GetFullName(intPrimary) + " (" + oUser.GetName(intPrimary) + ")";
                    }
                    if (intSecondary > 0)
                    {
                        txtSecondary.Text = oUser.GetFullName(intSecondary) + " (" + oUser.GetName(intSecondary) + ")";
                    }
                    if (intAppOwner > 0)
                    {
                        txtAppOwner.Text = oUser.GetFullName(intAppOwner) + " (" + oUser.GetName(intAppOwner) + ")";
                    }
                    if (intEngineer > 0)
                    {
                        txtEngineer.Text = oUser.GetFullName(intEngineer) + " (" + oUser.GetName(intEngineer) + ")";
                    }
                    hdnOwner.Value     = intOwner.ToString();
                    hdnPrimary.Value   = intPrimary.ToString();
                    hdnSecondary.Value = intSecondary.ToString();
                    hdnAppOwner.Value  = intAppOwner.ToString();
                    hdnEngineer.Value  = intEngineer.ToString();
                    int intModel = oForecast.GetModel(intID);
                    intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    intType  = oModel.GetType(intModel);
                    DataSet dsSteps  = oOnDemand.GetWizardSteps(intType, 1);
                    int     intCount = Int32.Parse(oOnDemand.GetWizardStep(intStep, "step"));
                    if (dsSteps.Tables[0].Rows.Count == intCount)
                    {
                        btnNext.Text = "Finish";
                    }
                    if (intCount == 0 || intCount == 1)
                    {
                        btnBack.Enabled = false;
                    }
                }
            }
            txtOwner.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divOwner.ClientID + "','" + lstOwner.ClientID + "','" + hdnOwner.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstOwner.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtPrimary.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divPrimary.ClientID + "','" + lstPrimary.ClientID + "','" + hdnPrimary.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstPrimary.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtSecondary.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divSecondary.ClientID + "','" + lstSecondary.ClientID + "','" + hdnSecondary.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstSecondary.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtAppOwner.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAppOwner.ClientID + "','" + lstAppOwner.ClientID + "','" + hdnAppOwner.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstAppOwner.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtEngineer.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divEngineer.ClientID + "','" + lstEngineer.ClientID + "','" + hdnEngineer.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstEngineer.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtMnemonic.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'500','195','" + divMnemonic.ClientID + "','" + lstMnemonic.ClientID + "','" + hdnMnemonic.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_mnemonics.aspx',2);");
            lstMnemonic.Attributes.Add("ondblclick", "AJAXClickRow();");
            txtCostCenter.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'200','195','" + divCostCenter.ClientID + "','" + lstCostCenter.ClientID + "','" + hdnCostCenter.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_cost_centers.aspx',5);");
            lstCostCenter.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnClose.Attributes.Add("onclick", "return window.close();");
            string strEngineer = "";

            if (oForecast.IsHACSM(intID) == true)
            {
                panEngineer.Visible = true;
                strEngineer         = " && ValidateHidden0('" + hdnEngineer.ClientID + "','" + txtEngineer.ClientID + "','Please enter the LAN ID of your network engineer')";
            }
            string strAppOwner = "";

            if (boolPNC == true)
            {
                panAppOwner.Visible = true;
                strAppOwner         = " && ValidateHidden0('" + hdnAppOwner.ClientID + "','" + txtAppOwner.ClientID + "','Please enter the LAN ID of your application owner')";
            }
            if (oClass.IsProd(intClass))
            {
                panDR.Visible = true;
                btnNext.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter an application name')" +
                                       strPNC +
                                       " && ValidateRadioButtons('" + radHigh.ClientID + "','" + radLow.ClientID + "','Please select the disaster recovery criticality')" +
                                       " && ValidateHidden0('" + hdnOwner.ClientID + "','" + txtOwner.ClientID + "','Please enter the LAN ID of your Departmental Manager')" +
                                       " && ValidateHidden0('" + hdnPrimary.ClientID + "','" + txtPrimary.ClientID + "','Please enter the LAN ID of your Application Technical Lead')" +
                                       //" && ValidateHidden0('" + hdnSecondary.ClientID + "','" + txtSecondary.ClientID + "','Please enter the LAN ID of your secondary administrator')" +
                                       strAppOwner +
                                       strEngineer +
                                       ";");
                btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter an application name')" +
                                         strPNC +
                                         " && ValidateRadioButtons('" + radHigh.ClientID + "','" + radLow.ClientID + "','Please select the disaster recovery criticality')" +
                                         " && ValidateHidden0('" + hdnOwner.ClientID + "','" + txtOwner.ClientID + "','Please enter the LAN ID of your Departmental Manager')" +
                                         " && ValidateHidden0('" + hdnPrimary.ClientID + "','" + txtPrimary.ClientID + "','Please enter the LAN ID of your Application Technical Lead')" +
                                         //" && ValidateHidden0('" + hdnSecondary.ClientID + "','" + txtSecondary.ClientID + "','Please enter the LAN ID of your secondary administrator')" +
                                         strAppOwner +
                                         strEngineer +
                                         ";");
            }
            else
            {
                btnNext.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter an application name')" +
                                       strPNC +
                                       " && ValidateHidden0('" + hdnOwner.ClientID + "','" + txtOwner.ClientID + "','Please enter the LAN ID of your Departmental Manager')" +
                                       " && ValidateHidden0('" + hdnPrimary.ClientID + "','" + txtPrimary.ClientID + "','Please enter the LAN ID of your Application Technical Lead')" +
                                       //" && ValidateHidden0('" + hdnSecondary.ClientID + "','" + txtSecondary.ClientID + "','Please enter the LAN ID of your secondary administrator')" +
                                       strAppOwner +
                                       strEngineer +
                                       ";");
                btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter an application name')" +
                                         strPNC +
                                         " && ValidateHidden0('" + hdnOwner.ClientID + "','" + txtOwner.ClientID + "','Please enter the LAN ID of your Departmental Manager')" +
                                         " && ValidateHidden0('" + hdnPrimary.ClientID + "','" + txtPrimary.ClientID + "','Please enter the LAN ID of your Application Technical Lead')" +
                                         //" && ValidateHidden0('" + hdnSecondary.ClientID + "','" + txtSecondary.ClientID + "','Please enter the LAN ID of your secondary administrator')" +
                                         strAppOwner +
                                         strEngineer +
                                         ";");
            }
            btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oRequestItem      = new RequestItems(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oApplication      = new Applications(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oVirtualCPU       = new VirtualCPU(intProfile, dsn);
            oVariable         = new Variables(intEnvironment);
            oFunction         = new Functions(0, dsn, intEnvironment);
            oUser             = new Users(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oWorkstation      = new Workstations(intProfile, dsn);
            oCostCenter       = new CostCenter(intProfile, dsn);

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rid"] != "" && Request.QueryString["rid"] != null)
            {
                if (!IsPostBack)
                {
                    LoadLists();
                }
                LoadValues();
                int    intItem        = Int32.Parse(lblItem.Text);
                int    intApp         = oRequestItem.GetItemApplication(intItem);
                string strDeliverable = oApplication.Get(intApp, "deliverables_doc");
                if (strDeliverable != "")
                {
                    panDeliverable.Visible = true;
                    btnDeliverable.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','" + strDeliverable + "');");
                }
                if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
                {
                    Int32.TryParse(Request.QueryString["id"], out intWorkstation);
                }
                if (intWorkstation > 0)
                {
                    panAccounts.Visible = true;
                }
                else
                {
                    panAccountsNo.Visible = true;
                }
                if (Request.QueryString["userid"] != null && Request.QueryString["userid"] != "")
                {
                    int intUser = Int32.Parse(Request.QueryString["userid"]);
                    trAccountUpdate.Visible  = true;
                    lblXID.Text              = oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")";
                    btnAddAccount.Text       = "Update";
                    btnCancelAccount.Visible = true;
                }
                else
                {
                    trNew.Visible = true;
                }

                if (Request.QueryString["accts"] != null && Request.QueryString["accts"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "accts", "<script type=\"text/javascript\">alert('Enter at least one account for this workstation');<" + "/" + "script>");
                }
                if (Request.QueryString["qty"] != null && Request.QueryString["qty"] != "")
                {
                    if (Request.QueryString["qty"] == intMaxWorkstationsPerDay.ToString())
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations and cannot be allocated additional hardware until tomorrow.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>");
                    }
                    else if (Request.QueryString["qty"] == "0")
                    {
                        int intDiff = intMaxWorkstationsPerDay - Int32.Parse(Request.QueryString["qty"]);
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations. Please enter a quantity of " + intDiff.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nPlease enter a quantity of " + intMaxWorkstationsPerDay.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>");
                    }
                }
                else if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "")
                {
                    intAnswer = Int32.Parse(Request.QueryString["aid"]);
                    if (!IsPostBack)
                    {
                        DataSet dsAnswer = oForecast.GetAnswer(intAnswer);
                        if (dsAnswer.Tables[0].Rows.Count > 0)
                        {
                            txtName.Text = dsAnswer.Tables[0].Rows[0]["name"].ToString();
                            ddlLocation.SelectedValue = dsAnswer.Tables[0].Rows[0]["addressid"].ToString();
                            ddlClass.SelectedValue    = dsAnswer.Tables[0].Rows[0]["classid"].ToString();
                            txtQuantity.Text          = dsAnswer.Tables[0].Rows[0]["quantity"].ToString();
                            dsAnswer = oForecast.GetWorkstation(intAnswer);
                            if (dsAnswer.Tables[0].Rows.Count > 0)
                            {
                                ddlRam.SelectedValue       = dsAnswer.Tables[0].Rows[0]["ramid"].ToString();
                                ddlOS.SelectedValue        = dsAnswer.Tables[0].Rows[0]["osid"].ToString();
                                chkDR.Checked              = (dsAnswer.Tables[0].Rows[0]["recovery"].ToString() == "1");
                                radEmployee.SelectedValue  = dsAnswer.Tables[0].Rows[0]["internal"].ToString();
                                ddlHardDrive.SelectedValue = dsAnswer.Tables[0].Rows[0]["hddid"].ToString();
                                ddlCPU.SelectedValue       = dsAnswer.Tables[0].Rows[0]["cpuid"].ToString();
                            }
                        }
                        else
                        {
                            intAnswer = 0;
                        }
                    }
                }

                if (intAnswer == 0)
                {
                    DataSet dsService = oForecast.GetAnswerService(Int32.Parse(Request.QueryString["rid"]));
                    if (dsService.Tables[0].Rows.Count > 0)
                    {
                        Redirect("&aid=" + dsService.Tables[0].Rows[0]["id"].ToString() + "&menu_tab=2");
                    }
                }
                if (intWorkstation > 0)
                {
                    DataSet dsWorkstation = oWorkstation.GetVirtual(intWorkstation);
                    if (dsWorkstation.Tables[0].Rows.Count > 0)
                    {
                        // Load Workstation
                        txtName.Text = dsWorkstation.Tables[0].Rows[0]["nickname"].ToString();
                        ddlLocation.SelectedValue = dsWorkstation.Tables[0].Rows[0]["addressid"].ToString();
                        int intClass = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["classid"].ToString());
                        ddlClass.SelectedValue = intClass.ToString();
                        txtQuantity.Text       = dsWorkstation.Tables[0].Rows[0]["quantity"].ToString();
                        int intOS = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["osid"].ToString());
                        LoadOS(intOS);
                        ddlOS.SelectedValue = intOS.ToString();
                        int intDomain = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["domainid"].ToString());
                        lblDomain.Text             = oDomain.Get(intDomain, "name");
                        radEmployee.SelectedValue  = dsWorkstation.Tables[0].Rows[0]["internal"].ToString();
                        chkDR.Checked              = (dsWorkstation.Tables[0].Rows[0]["recovery"].ToString() == "1");
                        ddlRam.SelectedValue       = dsWorkstation.Tables[0].Rows[0]["ramid"].ToString();
                        ddlHardDrive.SelectedValue = dsWorkstation.Tables[0].Rows[0]["hddid"].ToString();
                        ddlCPU.SelectedValue       = dsWorkstation.Tables[0].Rows[0]["cpuid"].ToString();
                        int intManager = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["appcontact"].ToString());
                        txtManager.Text  = oUser.GetFullName(intManager);
                        hdnManager.Value = intManager.ToString();
                        int intCost = Int32.Parse(dsWorkstation.Tables[0].Rows[0]["costcenterid"].ToString());
                        txtCostCenter.Text  = oCostCenter.GetName(intCost);
                        hdnCostCenter.Value = intCost.ToString();

                        // Load Accounts
                        txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                        lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
                        chkAdmin.Attributes.Add("onclick", "CheckAdmin(this);");
                        rptAccounts.DataSource = oWorkstation.GetAccountsVMware(intWorkstation);
                        rptAccounts.DataBind();
                        foreach (RepeaterItem ri in rptAccounts.Items)
                        {
                            LinkButton _delete = (LinkButton)ri.FindControl("btnDeleteAccount");
                            _delete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this account?') && LoadWait();");
                        }
                        if (rptAccounts.Items.Count == 0)
                        {
                            lblNone.Visible = true;
                            btnNext.Attributes.Add("onclick", "alert('Enter at least one account for this workstation');return false;");
                        }
                        else
                        {
                            btnNext.Attributes.Add("onclick", "return ProcessButton(this) && LoadWait();");
                        }
                        if (oClass.IsProd(intClass))
                        {
                            panProduction.Visible = true;
                        }
                        else
                        {
                            panAdmin.Visible = true;
                        }
                        btnAddAccount.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name') && ProcessButton(this) && LoadWait();");

                        trUpdate.Visible = true;
                        btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" +
                                                 " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an Operating System')" +
                                                 " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" +
                                                 " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" +
                                                 " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" +
                                                 " && ValidateHidden0('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter the LAN ID of your user access administrator')" +
                                                 " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center to be billed for this workstation')" +
                                                 " && ProcessButton(this) && LoadWait()" +
                                                 ";");
                    }
                    else
                    {
                        intWorkstation = 0;
                    }
                }

                if (intWorkstation == 0)
                {
                    btnNext.Attributes.Add("onclick", "return ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                                           " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" +
                                           " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an Operating System')" +
                                           " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" +
                                           " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" +
                                           " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" +
                                           " && ValidateHidden0('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter the LAN ID of your user access administrator')" +
                                           " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center to be billed for this workstation')" +
                                           " && ProcessButton(this) && LoadWait()" +
                                           ";");
                }
            }
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);

            oTab.AddTab("Workstation Details", "");
            oTab.AddTab("Account Configuration", "");
            strMenuTab1 = oTab.GetTabs();

            btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this service request?');");
            ddlOS.Attributes.Add("onchange", "LoadWait();");
            ddlRam.Attributes.Add("onchange", "LoadWait();");
            ddlCPU.Attributes.Add("onchange", "LoadWait();");
            ddlHardDrive.Attributes.Add("onchange", "LoadWait();");
            txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstManager.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
            btnManager2.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
            txtCostCenter.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'200','195','" + divCostCenter.ClientID + "','" + lstCostCenter.ClientID + "','" + hdnCostCenter.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_cost_centers.aspx',5);");
            lstCostCenter.Attributes.Add("ondblclick", "AJAXClickRow();");
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oVariable         = new Variables(intEnvironment);
            oWorkstation      = new Workstations(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oCostCenter       = new CostCenter(intProfile, dsn);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID = Int32.Parse(Request.QueryString["id"]);
            }
            if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
            {
                intStep = Int32.Parse(Request.QueryString["sid"]);
            }
            if (Request.QueryString["step"] != null && Request.QueryString["step"] != "")
            {
                panUpdate.Visible = true;
            }
            else
            {
                panNavigation.Visible = true;
            }
            int    intClass = 0;
            string strPool  = "";

            if (intID > 0)
            {
                DataSet ds = oForecast.GetAnswer(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (!IsPostBack)
                    {
                        LoadLists();
                    }
                    intRequest = oForecast.GetRequestID(intID, true);
                    //ddlCost.SelectedValue = ds.Tables[0].Rows[0]["costid"].ToString();
                    int intCostCenter = 0;
                    if (Int32.TryParse(ds.Tables[0].Rows[0]["costcenterid"].ToString(), out intCostCenter) == true && intCostCenter > 0)
                    {
                        txtCostCenter.Text = oCostCenter.GetName(intCostCenter);
                    }
                    hdnCostCenter.Value = intCostCenter.ToString();
                    intClass            = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                    if (oClass.IsProd(intClass))
                    {
                        if (ds.Tables[0].Rows[0]["poolid"].ToString() != "" && ds.Tables[0].Rows[0]["poolid"].ToString() != "0")
                        {
                            radExisting.Checked          = true;
                            divExisting.Style["display"] = "inline";
                            ddlExisting.SelectedValue    = ds.Tables[0].Rows[0]["poolid"].ToString();
                        }
                        else
                        {
                            radNone.Checked = true;
                        }
                        panPool.Visible = true;
                        strPool         = " && EnsurePool('" + radNone.ClientID + "','" + radNew.ClientID + "','" + txtName.ClientID + "','" + txtDescription.ClientID + "','" + radExisting.ClientID + "','" + ddlExisting.ClientID + "')";
                    }
                    int intManager = Int32.Parse(ds.Tables[0].Rows[0]["appcontact"].ToString());
                    if (intManager > 0)
                    {
                        txtManager.Text = oUser.GetFullName(intManager) + " (" + oUser.GetName(intManager) + ")";
                    }
                    hdnManager.Value = intManager.ToString();
                    int intModel = oForecast.GetModel(intID);
                    intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    intType  = oModel.GetType(intModel);
                    DataSet dsSteps  = oOnDemand.GetWizardSteps(intType, 1);
                    int     intCount = Int32.Parse(oOnDemand.GetWizardStep(intStep, "step"));
                    if (dsSteps.Tables[0].Rows.Count == intCount)
                    {
                        btnNext.Text = "Finish";
                    }
                    if (intCount == 0 || intCount == 1)
                    {
                        btnBack.Enabled = false;
                    }
                }
            }
            txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstManager.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
            btnClose.Attributes.Add("onclick", "return window.close();");
            btnNext.Attributes.Add("onclick", "return ValidateHidden0('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter the LAN ID of your user access administrator')" +
                                   " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center to be billed for this workstation')" +
                                   strPool +
                                   ";");
            btnUpdate.Attributes.Add("onclick", "return ValidateHidden0('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter the LAN ID of your user access administrator')" +
                                     " && ValidateHidden0('" + hdnCostCenter.ClientID + "','" + txtCostCenter.ClientID + "','Please enter the cost center to be billed for this workstation')" +
                                     strPool +
                                     ";");
            radNone.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','none');ShowHideDiv('" + divExisting.ClientID + "','none');");
            radNew.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','inline');ShowHideDiv('" + divExisting.ClientID + "','none');");
            radExisting.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','none');ShowHideDiv('" + divExisting.ClientID + "','inline');");
            txtCostCenter.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'200','195','" + divCostCenter.ClientID + "','" + lstCostCenter.ClientID + "','" + hdnCostCenter.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_cost_centers.aspx',5);");
            lstCostCenter.Attributes.Add("ondblclick", "AJAXClickRow();");
        }