protected void btnSubmit_Click(Object Sender, EventArgs e)
 {
     oWorkstation.UpdateVirtualAccounts(intWorkstation, 1);
     if (chkApply.Visible && chkApply.Checked)
     {
         DataSet dsAccounts = oWorkstation.GetAccountsVMware(intWorkstation);
         for (int ii = 2; dsAccounts.Tables[0].Rows.Count > 0 && ii <= intQuantity; ii++)
         {
             DataSet dsCopy  = oWorkstation.GetVirtual(intAnswer, ii);
             int     intCopy = 0;
             if (dsCopy.Tables[0].Rows.Count > 0)
             {
                 intCopy = Int32.Parse(dsCopy.Tables[0].Rows[0]["id"].ToString());
                 oWorkstation.DeleteAccounts(intCopy);
                 foreach (DataRow drAccount in dsAccounts.Tables[0].Rows)
                 {
                     int intUser   = Int32.Parse(drAccount["userid"].ToString());
                     int intAdmin  = Int32.Parse(drAccount["admin"].ToString());
                     int intRemote = Int32.Parse(drAccount["remote"].ToString());
                     oWorkstation.AddAccountFix(0, intCopy, intUser, intAdmin, intRemote);
                 }
                 oWorkstation.UpdateVirtualAccounts(intCopy, 1);
             }
         }
     }
     Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">window.opener.location.reload();window.close();<" + "/" + "script>");
 }
Exemple #2
0
        private void AddDevice(string _type, string _name, string _count, int _number)
        {
            boolOther   = !boolOther;
            strDevices += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + ">";
            strDevices += "<td>" + _type + "</td>";
            strDevices += "<td>" + _name + "</td>";
            strDevices += "<td>" + _count + "</td>";
            DataSet ds = oWorkstation.GetVirtual(intID, _number);
            bool    boolDeviceConfigured = true;

            if (ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows[0]["configured"].ToString() != "1")
            {
                boolDeviceConfigured = false;
            }
            if (boolDeviceConfigured == true)
            {
                strDevices += "<td nowrap align=\"center\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" onclick=\"OpenOnDemandDevice(" + intID + "," + _number.ToString() + ");\"/></td>";
            }
            else
            {
                strDevices    += "<td nowrap align=\"center\"><img src=\"/images/required.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" onclick=\"OpenOnDemandDevice(" + intID + "," + _number.ToString() + ");\"/></td>";
                boolConfigured = false;
            }
            strDevices += "</tr>";
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            Workstations     oWorkstation      = new Workstations(0, dsn);
            OnDemand         oOnDemand         = new OnDemand(0, dsn);
            Forecast         oForecast         = new Forecast(0, dsn);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                Functions oFunction      = new Functions(0, dsn, intEnvironment);
                int       intWorkstation = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["id"]));
                int       intType        = oModelsProperties.GetType(intModelVirtual);
                DataSet   dsSteps        = oOnDemand.GetSteps(intType, 1);
                DataSet   ds             = oWorkstation.GetVirtual(intWorkstation);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int          intAnswer   = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    int          intRemote   = Int32.Parse(ds.Tables[0].Rows[0]["remoteid"].ToString());
                    int          intCurrent  = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
                    Workstations workstation = new Workstations(0, dsnRemote);
                    DataSet      dsResult    = workstation.GetWorkstationVirtualRemoteStatus(intRemote);
                    if (dsResult.Tables[0].Rows.Count > 0)
                    {
                        int intStep = Int32.Parse(dsResult.Tables[0].Rows[0]["step"].ToString());
                        int intID   = Int32.Parse(dsResult.Tables[0].Rows[0]["id"].ToString());
                        if (intStep == 1)
                        {
                            oWorkstation.AssignHost(intWorkstation, dsnRemote, dsnAsset, intEnvironment, dsnZeus);
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirectWait();\");<" + "/" + "script>");
                        }
                        else if (intCurrent < intStep)
                        {
                            oOnDemand.UpdateStepDoneWorkstation(intWorkstation, intCurrent, oOnDemand.GetStep(intStep, "done"), 0, false, false);
                            oWorkstation.NextVirtualStep(intWorkstation);
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirect();\");<" + "/" + "script>");
                        }
                        else if (intCurrent == dsSteps.Tables[0].Rows.Count)
                        {
                            oWorkstation.NextVirtualStep(intWorkstation);
                            //SqlHelper.ExecuteNonQuery(dsnRemote, CommandType.Text, "UPDATE cv_virtual_workstations SET deleted = 1 WHERE id = " + intID.ToString() + " AND deleted = 0");
                            oForecast.UpdateAnswerCompleted(intAnswer);
                            oWorkstation.UpdateVirtualCompleted(intWorkstation);
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirect();\");<" + "/" + "script>");
                        }
                    }
                }
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirectWait();\");<" + "/" + "script>");
            }
        }
Exemple #4
0
        protected void btnSaveConfig_Click(Object Sender, EventArgs e)
        {
            int intConfigured  = ((ddlOS.SelectedIndex > 0 && Int32.Parse(Request.Form[hdnServicePack.UniqueID]) > 0 && ddlDomain.SelectedIndex > 0) ? 1 : 0);
            int intWorkstation = 0;

            if (lblId.Text != "")
            {
                intWorkstation = Int32.Parse(lblId.Text);
                oWorkstation.UpdateVirtual(intWorkstation, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), intConfigured);
            }
            else
            {
                intWorkstation = oWorkstation.AddVirtual(intRequest, intAnswer, intNumber, 1, intModelVMware, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "ramid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "recovery")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "internal")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "hddid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "cpuid")), intConfigured, 0);
            }
            oWorkstation.DeleteComponents(intWorkstation);
            foreach (ListItem oItem in chkComponents.Items)
            {
                if (oItem.Selected == true)
                {
                    oWorkstation.AddComponents(intWorkstation, Int32.Parse(oItem.Value));
                }
            }
            if (chkApply.Visible && chkApply.Checked)
            {
                for (int ii = 2; ii <= intQuantity; ii++)
                {
                    DataSet ds      = oWorkstation.GetVirtual(intAnswer, ii);
                    int     intCopy = 0;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        intCopy = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                        oWorkstation.UpdateVirtual(intCopy, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), intConfigured);
                    }
                    else
                    {
                        intCopy = oWorkstation.AddVirtual(intRequest, intAnswer, ii, 1, intModelVMware, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "ramid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "recovery")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "internal")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "hddid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "cpuid")), intConfigured, 0);
                    }
                    oWorkstation.DeleteComponents(intCopy);
                    foreach (ListItem oItem in chkComponents.Items)
                    {
                        if (oItem.Selected == true)
                        {
                            oWorkstation.AddComponents(intCopy, Int32.Parse(oItem.Value));
                        }
                    }
                }
            }
            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>");
        }
        protected void btnStep_Click(Object Sender, EventArgs e)
        {
            string strError       = "";
            int    intWorkstation = Int32.Parse(lblWorkstation.Text);

            if (chkStep.Checked == true)
            {
                int     intAsset2 = 0;
                int     intStep   = 0;
                DataSet ds        = oWorkstation.GetVirtualErrors(intWorkstation);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr["assetid"].ToString() != "")
                    {
                        intAsset2 = Int32.Parse(dr["assetid"].ToString());
                    }
                    if (dr["fixed"].ToString() == "")
                    {
                        intStep = Int32.Parse(dr["step"].ToString());
                    }
                }
                if (intWorkstation > 0)
                {
                    oWorkstation.UpdateVirtualError(intWorkstation, intStep, 0, 0);
                    if (intAsset2 > 0)
                    {
                        string strSerial = oAsset.Get(intAsset2, "serial");
                        oZeus.UpdateResults(strSerial);
                    }
                    else
                    {
                        strError = "Warning: Invalid AssetID";
                    }
                }
                else
                {
                    strError = "Error: Invalid WorkstationID";
                }
            }
            if (chkStepVMWare.Checked == true)
            {
                VMWare oVMWare            = new VMWare(0, dsn);
                int    intWorkstationName = 0;
                Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "nameid"), out intWorkstationName);
                oVMWare.DeleteGuest(oWorkstation.GetName(intWorkstationName));
            }
            oWorkstation.UpdateVirtualStep(intWorkstation, Int32.Parse(txtStep.Text));
            Response.Redirect(Request.Path + "?q=" + Request.QueryString["q"] + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&admin=true&menu_tab=6&result=" + oFunction.encryptQueryString((strError == "" ? "Success" : strError)));
        }
        protected void btnNext_Click(Object Sender, EventArgs e)
        {
            int intRequest = Int32.Parse(Request.QueryString["rid"]);
            int intItem    = Int32.Parse(lblItem.Text);
            int intNumber  = Int32.Parse(lblNumber.Text);

            foreach (ListItem oList in lstWorkstations.Items)
            {
                if (oList.Selected == true)
                {
                    int     intWorkstation = Int32.Parse(oList.Value);
                    DataSet dsWorkstation  = oWorkstation.GetVirtual(intWorkstation);
                    if (dsWorkstation.Tables[0].Rows.Count > 0)
                    {
                        oCustomized.AddVirtualWorkstationAccount(intRequest, intItem, intNumber, intWorkstation);
                        oWorkstation.AddAccountFix(Int32.Parse(dsWorkstation.Tables[0].Rows[0]["assetid"].ToString()), 0, Int32.Parse(Request.Form[hdnManager.UniqueID]), 0, 1);
                    }
                }
            }
            oRequestItem.UpdateForm(intRequest, true);
            Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            OnDemand         oOnDemand         = new OnDemand(0, dsn);
            Forecast         oForecast         = new Forecast(0, dsn);
            Workstations     oWorkstation      = new Workstations(0, dsn);
            Models           oModel            = new Models(0, dsn);
            Users            oUser             = new Users(0, dsn);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
            Functions        oFunction         = new Functions(0, dsn, intEnvironment);
            Asset            oAsset            = new Asset(0, dsnAsset);
            Tokens           oToken            = new Tokens(0, dsn);
            string           strOnLoad         = "";
            string           strError          = "";

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int     intWorkstation = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["id"]));
                DataSet ds             = oWorkstation.GetVirtual(intWorkstation);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    int intAsset  = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());

                    if (intAsset > 0 && oAsset.Get(intAsset, "name") != "")
                    {
                        strName = oAsset.Get(intAsset, "name");
                    }
                    else
                    {
                        strName = "Device " + Request.QueryString["c"];
                    }
                    int intModel = oForecast.GetModelAsset(intAnswer);
                    if (intModel == 0)
                    {
                        intModel = oForecast.GetModel(intAnswer);
                    }
                    intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    int intType             = oModel.GetType(intModel);
                    int intCurrent          = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
                    int intCurrentWithError = oWorkstation.GetVirtualStep(intWorkstation);
                    strPreviewName = strName;
                    DataSet dsSteps = oOnDemand.GetSteps(intType, 1);
                    if (dsSteps.Tables[0].Rows.Count >= intCurrent)
                    {
                        int     intNewStep = Int32.Parse(dsSteps.Tables[0].Rows[intCurrent - 1]["id"].ToString());
                        DataSet dsStep     = oOnDemand.GetStep(intNewStep);
                        if (dsStep.Tables[0].Rows.Count > 0)
                        {
                            string strPath = dsStep.Tables[0].Rows[0]["path"].ToString();
                            if (dsStep.Tables[0].Rows[0]["show_build"].ToString() == "1")
                            {
                                chkPreview.Disabled = false;
                                if (!IsPostBack && Request.QueryString["preview"] != null)
                                {
                                    intShowBuild       = 1;
                                    chkPreview.Checked = true;
                                    // Token
                                    strPreviewToken = oToken.Add(strPreviewName, 50);
                                }
                            }
                            else
                            {
                                chkPreview.Disabled = true;
                            }
                            if (strPath != "")
                            {
                                Control oControl = (Control)LoadControl(strPath);
                                PH.Controls.Add(oControl);
                                strOnLoad = "redirectWait();";
                            }
                            else
                            {
                                strOnLoad = "redirectAJAX('" + intWorkstation.ToString() + "','" + intCurrentWithError.ToString() + "');";
                            }
                        }
                    }
                    else
                    {
                        panDone.Visible = true;
                        if (ds.Tables[0].Rows[0]["completed"].ToString() != "")
                        {
                            lblCompleted.Text = DateTime.Parse(ds.Tables[0].Rows[0]["completed"].ToString()).ToString();
                        }
                        else
                        {
                            lblCompleted.Text = DateTime.Now.ToString();
                        }
                    }

                    int           intStep   = 0;
                    StringBuilder sbStep    = new StringBuilder();
                    bool          boolError = false;
                    foreach (DataRow drStep in dsSteps.Tables[0].Rows)
                    {
                        intStep++;
                        string strClass = "cantclose";
                        if (drStep["type"].ToString() == "1")
                        {
                            strClass = "canclose";
                        }
                        if (drStep["type"].ToString() == "-1")
                        {
                            strClass = "default";
                        }
                        DataSet dsResult = oOnDemand.GetStepDoneWorkstation(intWorkstation, intStep);
                        if (intStep < intCurrent)
                        {
                            string strImage   = "<img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\">";
                            string strDone    = "";
                            string strMessage = "";
                            if (dsResult.Tables[0].Rows.Count > 0)
                            {
                                foreach (DataRow drResult in dsResult.Tables[0].Rows)
                                {
                                    strMessage += drResult["result"].ToString();
                                }
                                if (dsResult.Tables[0].Rows[0]["finished"].ToString() != "")
                                {
                                    strDone = "&nbsp;&nbsp;(" + DateTime.Parse(dsResult.Tables[0].Rows[0]["finished"].ToString()).ToString() + ")";
                                }
                            }
                            sbStep.Append("<tr><td>");
                            sbStep.Append(strImage);
                            sbStep.Append("</td><td nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHideResult('divResult_");
                            sbStep.Append(intAnswer.ToString());
                            sbStep.Append("_");
                            sbStep.Append(intStep.ToString());
                            sbStep.Append("');\">");
                            sbStep.Append(drStep["title"].ToString());
                            sbStep.Append("</a>");
                            sbStep.Append(strDone);
                            sbStep.Append("</td></tr>");
                            sbStep.Append("<tr id=\"divResult_");
                            sbStep.Append(intAnswer.ToString());
                            sbStep.Append("_");
                            sbStep.Append(intStep.ToString());
                            sbStep.Append("\" style=\"display:none\"><td></td><td>");
                            sbStep.Append(strMessage == "" ? "No information" : strMessage);
                            sbStep.Append("</td></tr>");
                        }
                        else if (intStep == intCurrent)
                        {
                            strError = "";
                            if (dsResult.Tables[0].Rows.Count > 0)
                            {
                                if (dsResult.Tables[0].Rows[0]["error"].ToString() == "1")
                                {
                                    boolError = true;
                                    sbStep.Append("<tr><td><img src=\"/images/error.gif\" border=\"0\" align=\"absmiddle\"></td><td class=\"");
                                    sbStep.Append(strClass);
                                    sbStep.Append("\" nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHideResult('divResult_");
                                    sbStep.Append(intAnswer.ToString());
                                    sbStep.Append("_");
                                    sbStep.Append(intStep.ToString());
                                    sbStep.Append("');\">");
                                    sbStep.Append(drStep["title"].ToString());
                                    sbStep.Append("</a></td></tr>");
                                    sbStep.Append("<tr id=\"divResult_");
                                    sbStep.Append(intAnswer.ToString());
                                    sbStep.Append("_");
                                    sbStep.Append(intStep.ToString());
                                    sbStep.Append("\" style=\"display:none\"><td></td><td>");
                                    strError = dsResult.Tables[0].Rows[0]["result"].ToString();
                                    if (strError.Contains("~") == true)
                                    {
                                        strError = strError.Substring(0, strError.IndexOf("~"));
                                    }
                                    sbStep.Append(strError);
                                    DataSet dsError  = oWorkstation.GetVirtualError(intWorkstation, intStep);
                                    string  incident = "";
                                    int     assigned = 0;
                                    if (dsError.Tables[0].Rows.Count > 0)
                                    {
                                        incident = dsError.Tables[0].Rows[0]["incident"].ToString();
                                        Int32.TryParse(dsError.Tables[0].Rows[0]["assigned"].ToString(), out assigned);
                                        if (string.IsNullOrEmpty(incident) == false)
                                        {
                                            sbStep.Append("<br/><br/>Tracking # " + incident);
                                            bool    IncidentFound = false;
                                            DataSet dsKey         = oFunction.GetSetupValuesByKey("INCIDENTS");
                                            if (dsKey.Tables[0].Rows.Count > 0)
                                            {
                                                string       incidents   = dsKey.Tables[0].Rows[0]["Value"].ToString();
                                                StreamReader theReader   = new StreamReader(incidents);
                                                string       theContents = theReader.ReadToEnd();
                                                string[]     theLines    = theContents.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                                                foreach (string theLine in theLines)
                                                {
                                                    if (theLine.Contains(incident))
                                                    {
                                                        IncidentFound = true;
                                                        string[] theFields = theLine.Split(new char[] { ',' }, StringSplitOptions.None);
                                                        string   person    = theFields[5].Replace("\"", "");
                                                        if (String.IsNullOrEmpty(person) == false)
                                                        {
                                                            sbStep.Append("<br/>Assigned To: " + person);
                                                        }
                                                        string group = theFields[4].Replace("\"", "");
                                                        if (String.IsNullOrEmpty(group) == false)
                                                        {
                                                            sbStep.Append("<br/>Group: " + group);
                                                        }
                                                        break;
                                                    }
                                                }
                                            }
                                            if (IncidentFound == false)
                                            {
                                                if (assigned > 0)
                                                {
                                                    sbStep.Append("<br/>Assigned To: " + oUser.GetFullNameWithLanID(assigned));
                                                }
                                            }
                                        }
                                    }
                                    if (strError != "")
                                    {
                                        sbStep.Append("<br/><br/><a class='build_error' href=\"javascript:void(0);\" onclick=\"OpenWindow('PROVISIONING_ERROR', '");
                                        sbStep.Append(oFunction.encryptQueryString(dsResult.Tables[0].Rows[0]["result"].ToString()));
                                        sbStep.Append("');\"><img src='/images/plus.gif' border='0' align='absmiddle'/>&nbsp;For more information about this error, click here</a>");
                                    }
                                    sbStep.Append("</td></tr>");
                                }
                            }
                            if (boolError == false)
                            {
                                if (drStep["interact_path"].ToString() == "")
                                {
                                    sbStep.Append("<tr><td><img src=\"/images/green_arrow.gif\" border=\"0\" align=\"absmiddle\"></td><td class=\"");
                                    sbStep.Append(strClass);
                                    sbStep.Append("\" nowrap><b>");
                                    sbStep.Append(drStep["title"].ToString());
                                    sbStep.Append("</b></td></tr>");
                                }
                                else
                                {
                                    sbStep.Append("<tr><td><img src=\"/images/alert.gif\" border=\"0\" align=\"absmiddle\"></td><td class=\"");
                                    sbStep.Append(strClass);
                                    sbStep.Append("\" nowrap><b>");
                                    sbStep.Append(drStep["title"].ToString());
                                    sbStep.Append("</b></td></tr>");
                                    sbStep.Append("<tr><td></td><td><input type=\"button\" onclick=\"OpenWindow('NEW_WINDOW','");
                                    sbStep.Append(drStep["interact_path"].ToString());
                                    sbStep.Append("?id=");
                                    sbStep.Append(intWorkstation.ToString());
                                    sbStep.Append("');\" value=\"Click Here\" class=\"default\" style=\"width:100px\"></td></tr>");
                                }
                            }
                        }
                        else if (intStep > intCurrent)
                        {
                            sbStep.Append("<tr><td></td><td class=\"");
                            sbStep.Append(strClass);
                            sbStep.Append("\">");
                            sbStep.Append(drStep["title"].ToString());
                            sbStep.Append("</td></tr>");
                        }
                    }
                    sbStep.Insert(0, "<p><table border=\"0\" cellpadding=\"4\" cellspacing=\"3\">");
                    sbStep.Append("</table></p>");
                    strResult += sbStep.ToString();

                    //DateTime datSubmitted = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString());
                    //lblDate.Text = datSubmitted.ToString();
                    //Holidays oHoliday = new Holidays(0, dsn);
                    //lblDelivered.Text = oHoliday.GetDays(10.00, datSubmitted).ToString();
                }
            }
            else
            {
                Response.Write("Invalid Configuration - validate host configuration");
            }

            if (strOnLoad != "")
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "start_count", "<script type=\"text/javascript\">window.onload = new Function(\"" + strOnLoad + "\");" + (strError == "" ? "" : "LoadError('" + strError.Replace("'", "") + "');") + "<" + "/" + "script>");
            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oWorkstation     = new Workstations(intProfile, dsn);
            oServer          = new Servers(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oVMWare          = new VMWare(intProfile, dsn);
            oAsset           = new Asset(intProfile, dsnAsset, dsn);
            oError           = new Errors(intProfile, dsn);
            oZeus            = new Zeus(intProfile, dsnZeus);
            oVariable        = new Variables(intEnvironment);
            oOperatingSystem = new OperatingSystems(intProfile, dsn);

            lblTitle.Text = "Provisioning Issue";
            string strUser = Request.ServerVariables["logon_user"];

            strUser = strUser.Substring(strUser.LastIndexOf("\\") + 1);
            intUser = oUser.GetId(strUser);

            if (intUser > 0)
            {
                if (Request.QueryString["fixed"] != null && Request.QueryString["fixed"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "fixed", "<script type=\"text/javascript\">alert('The issue has been saved and the device is queued to continue.\\n\\nThis window will now be closed.');window.close();<" + "/" + "script>");
                }
                if (Request.QueryString["type"] != null && Request.QueryString["id"] != null)
                {
                    try
                    {
                        intID = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["id"]));
                    }
                    catch
                    {
                        intID = 0;
                    }
                    if (intID > 0)
                    {
                        if (!IsPostBack)
                        {
                            bool boolVMware = false;
                            if (Request.QueryString["type"] == "s")
                            {
                                lblType.Text  = "Server";
                                lblLabel.Text = "Design ID:";
                                DataSet ds = oServer.GetErrors(intID);
                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    if (dr["fixed"].ToString() == "")
                                    {
                                        lblName.Text  = dr["servername"].ToString();
                                        lblDate.Text  = dr["created"].ToString();
                                        lblIssue.Text = dr["reason"].ToString();

                                        int intServer = 0;
                                        if (dr["serverid"].ToString() != "")
                                        {
                                            intServer = Int32.Parse(dr["serverid"].ToString());
                                        }
                                        if (intServer > 0)
                                        {
                                            int intOS = 0;
                                            Int32.TryParse(oServer.Get(intServer, "osid"), out intOS);
                                            lblOS.Text    = oOperatingSystem.Get(intOS, "name");
                                            lblValue.Text = oServer.Get(intServer, "answerid");
                                        }

                                        int intAsset = 0;
                                        if (dr["assetid"].ToString() != "")
                                        {
                                            intAsset = Int32.Parse(dr["assetid"].ToString());
                                        }
                                        lblAsset.Text = intAsset.ToString();
                                        lblStep.Text  = dr["step"].ToString();

                                        if (intAsset != 0)
                                        {
                                            string strILO = oAsset.GetServerOrBlade(intAsset, "ilo");
                                            if (strILO != "")
                                            {
                                                panVMwareNo.Visible = true;
                                                lblConsole.Text     = "<a href=\"https://" + strILO + "\" target=\"_blank\">" + strILO + "</a>";
                                            }
                                            else
                                            {
                                                boolVMware = true;
                                            }
                                        }
                                    }
                                }

                                // Load Existing Errors
                                Tab oTab = new Tab("", 0, "divMenu1", true, false);
                                rptRelated.DataSource = oError.Gets(lblIssue.Text, intUser);
                                rptRelated.DataBind();
                                int intTab = 0;
                                foreach (RepeaterItem ri in rptRelated.Items)
                                {
                                    intTab++;
                                    oTab.AddTab("Solution # " + intTab.ToString(), "");
                                    ((Button)ri.FindControl("btnSelect")).Attributes.Add("onclick", "return confirm('Are you sure you want to select this solution as the fix?');");
                                    Label lblAttach = (Label)ri.FindControl("lblAttach");
                                    Panel panAttach = (Panel)ri.FindControl("panAttach");
                                    if (lblAttach.Text != "")
                                    {
                                        panAttach.Visible = true;
                                        string strAttach = lblAttach.Text;
                                        if (strAttach.Contains("\\") == true)
                                        {
                                            strAttach = strAttach.Substring(strAttach.LastIndexOf("\\") + 1);
                                        }
                                        lblAttach.Text = "<a href=\"" + lblAttach.Text + "\" target=\"_blank\">" + strAttach + "</a>";
                                    }
                                }
                                strMenuTab1    = oTab.GetTabs();
                                trNone.Visible = (rptRelated.Items.Count == 0);
                            }
                            else if (Request.QueryString["type"] == "w")
                            {
                                if (!IsPostBack)
                                {
                                    lblType.Text  = "Workstation";
                                    lblLabel.Text = "Request ID:";
                                    DataSet ds = oWorkstation.GetVirtualErrors(intID);
                                    foreach (DataRow dr in ds.Tables[0].Rows)
                                    {
                                        if (dr["fixed"].ToString() == "")
                                        {
                                            lblName.Text  = dr["workstationname"].ToString();
                                            lblDate.Text  = dr["created"].ToString();
                                            lblIssue.Text = dr["reason"].ToString();

                                            int intWorkstation = 0;
                                            if (dr["workstationid"].ToString() != "")
                                            {
                                                intWorkstation = Int32.Parse(dr["workstationid"].ToString());
                                            }
                                            if (intWorkstation > 0)
                                            {
                                                int intOS = 0;
                                                Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "osid"), out intOS);
                                                lblOS.Text    = oOperatingSystem.Get(intOS, "name");
                                                lblValue.Text = oWorkstation.GetVirtual(intWorkstation, "requestid");
                                            }

                                            int intAsset = 0;
                                            if (dr["assetid"].ToString() != "")
                                            {
                                                intAsset = Int32.Parse(dr["assetid"].ToString());
                                            }
                                            lblAsset.Text = intAsset.ToString();
                                            lblStep.Text  = dr["step"].ToString();

                                            boolVMware = true;
                                        }
                                    }

                                    // Load Existing Errors
                                    Tab oTab = new Tab("", 0, "divMenu1", true, false);
                                    rptRelated.DataSource = oError.Gets(lblError.Text, 0);
                                    rptRelated.DataBind();
                                    int intTab = 0;
                                    foreach (RepeaterItem ri in rptRelated.Items)
                                    {
                                        intTab++;
                                        oTab.AddTab("Solution # " + intTab.ToString(), "");
                                        ((Button)ri.FindControl("btnSelect")).Attributes.Add("onclick", "return confirm('Are you sure you want to select this solution as the fix?');");
                                        Label lblAttach = (Label)ri.FindControl("lblAttach");
                                        Panel panAttach = (Panel)ri.FindControl("panAttach");
                                        if (lblAttach.Text != "")
                                        {
                                            panAttach.Visible = true;
                                            string strAttach = lblAttach.Text;
                                            if (strAttach.Contains("\\") == true)
                                            {
                                                strAttach = strAttach.Substring(strAttach.LastIndexOf("\\") + 1);
                                            }
                                            lblAttach.Text = "<a href=\"" + lblAttach.Text + "\" target=\"_blank\">" + strAttach + "</a>";
                                        }
                                    }
                                    strMenuTab1    = oTab.GetTabs();
                                    trNone.Visible = (rptRelated.Items.Count == 0);
                                }
                            }

                            if (boolVMware == true)
                            {
                                panVMware.Visible = true;
                                DataSet dsGuest = oVMWare.GetGuest(lblName.Text);
                                if (dsGuest.Tables[0].Rows.Count > 0)
                                {
                                    DataRow drGuest      = dsGuest.Tables[0].Rows[0];
                                    int     intDatastore = Int32.Parse(drGuest["datastoreid"].ToString());
                                    lblDataStore.Text = oVMWare.GetDatastore(intDatastore, "name");
                                    int intHost    = Int32.Parse(drGuest["hostid"].ToString());
                                    int intCluster = Int32.Parse(oVMWare.GetHost(intHost, "clusterid"));
                                    lblCluster.Text = oVMWare.GetCluster(intCluster, "name");
                                    int intFolder = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid"));
                                    lblFolder.Text = oVMWare.GetFolder(intFolder, "name");
                                    int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid"));
                                    lblDataCenter.Text = oVMWare.GetDatacenter(intDataCenter, "name");
                                    int intVirtualCenter = Int32.Parse(oVMWare.GetDatacenter(intDataCenter, "virtualcenterid"));
                                    lblVirtualCenter.Text = oVMWare.GetVirtualCenter(intVirtualCenter, "name");
                                }
                            }

                            if (lblName.Text == "")
                            {
                                lblError.Text = "This device is not experiencing any provisioning issues at the moment (" + intID.ToString() + ")";
                            }

                            // Load the case codes
                            ddlCode.DataTextField  = "name";
                            ddlCode.DataValueField = "id";
                            ddlCode.DataSource     = oError.GetTypeTypes(2, 1);
                            ddlCode.DataBind();
                            ddlCode.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        }
                    }
                    else
                    {
                        lblError.Text = "Could not find record";
                    }
                }
                else
                {
                    lblError.Text = "Invalid Parameter(s)";
                }
            }
            else
            {
                lblError.Text = "Could not find a user account for userID = " + strUser;
            }

            if (lblError.Text == "")
            {
                panIssue.Visible = true;
                btnFixed.Attributes.Add("onclick", "return ValidateText('" + txtIssue.ClientID + "','Please enter the issue') && ValidateText('" + txtResolution.ClientID + "','Please enter the resolution') && ValidateDropDown('" + ddlCode.ClientID + "','Please select a case code') && confirm('Are you sure you want to mark this error as fixed?') && ProcessButton(this);");
                radNew.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','inline');ShowHideDiv('" + divExisting.ClientID + "','none');");
                radExisting.Attributes.Add("onclick", "ShowHideDiv('" + divNew.ClientID + "','none');ShowHideDiv('" + divExisting.ClientID + "','inline');");
            }
            else
            {
                panDenied.Visible = true;
                btnClose.Attributes.Add("onclick", "window.close();");
            }
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            intProfile   = 0;
            oWorkstation = new Workstations(intProfile, dsn);
            oRemote      = new Workstations(intProfile, dsnRemote);
            oUser        = new Users(intProfile, dsn);
            oVariable    = new Variables(intEnvironment);
            oOnDemand    = new OnDemand(intProfile, dsn);
            oForecast    = new Forecast(intProfile, dsn);
            oClass       = new Classes(intProfile, dsn);
            string strUsers = "";

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int     intWorkstation = Int32.Parse(Request.QueryString["id"]);
                DataSet ds             = oWorkstation.GetVirtual(intWorkstation);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intStep   = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
                    intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    intAsset  = Int32.Parse(ds.Tables[0].Rows[0]["assetid"].ToString());
                    intRemote = Int32.Parse(ds.Tables[0].Rows[0]["remoteid"].ToString());
                    int     intClass  = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
                    int     intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString());
                    Domains oDomain   = new Domains(intProfile, dsn);
                    lblDomain.Text = oDomain.Get(intDomain, "name");
                    intDomain      = Int32.Parse(oDomain.Get(intDomain, "environment"));
                    int intName = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString());
                    lblWorkstation.Text = oWorkstation.GetName(intName);
                    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();");
                    DataSet dsAccounts = oWorkstation.GetAccountsVirtual(intAsset);
                    rptAccounts.DataSource = dsAccounts;
                    rptAccounts.DataBind();
                    foreach (RepeaterItem ri in rptAccounts.Items)
                    {
                        LinkButton _delete = (LinkButton)ri.FindControl("btnDelete");
                        _delete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this account?');");
                    }
                    foreach (DataRow drAccount in dsAccounts.Tables[0].Rows)
                    {
                        strUsers += oUser.GetName(Int32.Parse(drAccount["userid"].ToString())) + ";";
                    }
                    if (rptAccounts.Items.Count == 0)
                    {
                        lblNone.Visible = true;
                        btnSubmit.Attributes.Add("onclick", "alert('You must add at least one account or select the skip button');return false;");
                    }
                    if (oClass.IsProd(intClass))
                    {
                        panProduction.Visible = true;
                    }
                    else
                    {
                        panAdmin.Visible = true;
                    }
                }
            }
            else
            {
                btnAdd.Enabled    = false;
                btnSubmit.Enabled = false;
                btnSkip.Enabled   = false;
            }
            btnSkip.Enabled = false;
            //btnSkip.Attributes.Add("onclick", "return confirm('Are you sure you want to skip the account configuration process?');");
            btnAdd.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name') && EnsureAccenture('" + hdnUser.ClientID + "','" + strUsers + "');");
            //btnAdd.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name')" + (boolProduction == true ? " && EnsureAccenture('" + hdnUser.ClientID + "','" + strUsers + "')" : "") + ";");
            btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);
            Functions       oFunction       = new Functions(intProfile, dsn, intEnvironment);
            Workstations    oWorkstation    = new Workstations(intProfile, dsn);
            Customized      oCustomized     = new Customized(intProfile, dsn);
            Forecast        oForecast       = new Forecast(intProfile, dsn);
            Variables       oVariable       = new Variables(intEnvironment);
            Users           oUser           = new Users(intProfile, dsn);
            int             intRequest      = Int32.Parse(Request.QueryString["rid"]);
            string          strStatus       = oServiceRequest.Get(intRequest, "checkout");
            DataSet         dsItems         = oRequestItem.GetForms(intRequest);
            int             intItem         = 0;
            int             intService      = 0;
            int             intNumber       = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        bool   boolSuccess = true;
                        string strResult   = oService.GetName(intService) + " Completed";
                        string strError    = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        DataSet ds = oCustomized.GetVirtualWorkstationAccount(intRequest, intItem, intNumber);
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            int    intWorkstation = Int32.Parse(dr["workstationid"].ToString());
                            int    intAnswer      = Int32.Parse(oWorkstation.GetVirtual(intWorkstation, "answerid"));
                            int    intUser        = Int32.Parse(oForecast.GetAnswer(intAnswer, "appcontact"));
                            string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_REQUEST_ASSIGNMENT");
                            oFunction.SendEmail("Virtual Workstation Account Approval", oUser.GetName(intUser), strEMailIdsBCC, strEMailIdsBCC, "Virtual Workstation Account Approval", "<p><b>A virtual workstation account request requires your approval.</b></p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/approval/workstation/account.aspx?id=" + intWorkstation.ToString() + "\" target=\"_blank\">Click here to view this request.</a></p>", true, false);
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + strResult + "</span></p>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> " + strError + "</span></p>";
                            }
                            else
                            {
                                strDone += "<p><span class=\"biggerbold\"><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/> " + oService.GetName(intService) + " Submitted</span></p>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Title = "ClearView Account Configuration";
     AuthenticateUser();
     intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
     oUser        = new Users(intProfile, dsn);
     oVariable    = new Variables(intEnvironment);
     oFunction    = new Functions(0, dsn, intEnvironment);
     oForecast    = new Forecast(intProfile, dsn);
     oWorkstation = new Workstations(intProfile, dsn);
     oOnDemand    = new OnDemand(intProfile, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intWorkstation = Int32.Parse(Request.QueryString["id"]);
         Page.Title     = "ClearView Account Configuration | Workstation # " + intWorkstation.ToString();
         DataSet ds = oWorkstation.GetVirtual(intWorkstation);
         if (ds.Tables[0].Rows.Count > 0)
         {
             if (Request.QueryString["userid"] != null && Request.QueryString["userid"] != "")
             {
                 int intUser = Int32.Parse(Request.QueryString["userid"]);
                 trUpdate.Visible  = true;
                 lblXID.Text       = oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")";
                 btnAdd.Text       = "Update";
                 btnCancel.Visible = true;
             }
             else
             {
                 trNew.Visible = true;
             }
             intStep     = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
             intInternal = Int32.Parse(ds.Tables[0].Rows[0]["internal"].ToString());
             intAnswer   = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
             int     intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
             DataSet dsAnswer  = oForecast.GetAnswer(intAnswer);
             if (dsAnswer.Tables[0].Rows.Count > 0)
             {
                 intQuantity      = Int32.Parse(dsAnswer.Tables[0].Rows[0]["quantity"].ToString());
                 chkApply.Visible = (intQuantity > 1 && intNumber == 1);
             }
             intRequest = oForecast.GetRequestID(intAnswer, true);
             intDomain  = Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString());
             Domains oDomain  = new Domains(intProfile, dsn);
             int     intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
             Classes oClass   = new Classes(intProfile, dsn);
             if (oForecast.GetAnswer(intAnswer, "test") == "1")
             {
                 intDomain = Int32.Parse(ds.Tables[0].Rows[0]["test_domainid"].ToString());
             }
             lblDomain.Text = oDomain.Get(intDomain, "name");
             Requests oRequest = new Requests(intProfile, dsn);
             //if (oRequest.GetUser(intRequest) == intProfile)
             //{
             panPermit.Visible = true;
             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);");
             ds = oWorkstation.GetAccountsVMware(intWorkstation);
             rptAccounts.DataSource = ds;
             rptAccounts.DataBind();
             foreach (RepeaterItem ri in rptAccounts.Items)
             {
                 LinkButton _delete = (LinkButton)ri.FindControl("btnDelete");
                 _delete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this account?');");
             }
             if (rptAccounts.Items.Count == 0)
             {
                 lblNone.Visible = true;
                 btnSubmit.Attributes.Add("onclick", "alert('You must add at least one account or select the skip button');return false;");
             }
             //if (oClass.IsProd(intClass))
             panProduction.Visible = true;
             //else
             //    panAdmin.Visible = true;
         }
     }
     else
     {
         btnAdd.Enabled    = false;
         btnSubmit.Enabled = false;
         btnSkip.Enabled   = false;
     }
     btnSkip.Enabled = false;
     //btnSkip.Attributes.Add("onclick", "return confirm('Are you sure you want to skip the account configuration process?');");
     btnAdd.Attributes.Add("onclick", "return ValidateHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name');");
     btnManager.Attributes.Add("onclick", "return OpenWindow('NEW_USER','');");
 }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Int32.TryParse(Request.Cookies["profileid"].Value, out intProfile);
            oServer      = new Servers(intProfile, dsn);
            oServerName  = new ServerName(intProfile, dsn);
            oWorkstation = new Workstations(intProfile, dsn);
            oAsset       = new Asset(intProfile, dsnAsset, dsn);

            Int32.TryParse(Request.QueryString["assetid"], out intAsset);

            bool boolMessage = false;

            if (Request.QueryString["changed"] != null)
            {
                boolMessage = true;
                Page.ClientScript.RegisterStartupScript(typeof(Page), "changed", "<script type=\"text/javascript\">alert('Device Name Changed Successfully!');RefreshOpeningWindow();window.close();<" + "/" + "script>");
            }
            if (Request.QueryString["cleared"] != null)
            {
                boolMessage = true;
                Page.ClientScript.RegisterStartupScript(typeof(Page), "cleared", "<script type=\"text/javascript\">alert('Device Name Cleared Successfully!');RefreshOpeningWindow();window.close();<" + "/" + "script>");
            }
            if (Request.QueryString["error"] != null)
            {
                boolMessage = true;
                Page.ClientScript.RegisterStartupScript(typeof(Page), "bad", "<script type=\"text/javascript\">alert('There was a problem changing the device name...\\n\\n" + Request.QueryString["error"] + "');<" + "/" + "script>");
            }

            if (Int32.TryParse(oAsset.GetStatus(intAsset, "status"), out intStatus) == true)
            {
                if (!IsPostBack)
                {
                    string strAdditional = "";
                    if (intAsset > 0 && Int32.TryParse(oAsset.GetStatus(intAsset, "status"), out intStatus) == true)
                    {
                        if (Request.QueryString["clear"] != null)
                        {
                            if (Request.QueryString["clear"] == "Clear")
                            {
                                radClear.SelectedValue = "Clear";
                                if (intStatus == (int)AssetStatus.InUse)
                                {
                                    lblError.Text = "Can not clear the name of an asset while its Status is &quot;In Use&quot;.";
                                }
                                panClear.Visible = true;
                                panID.Visible    = true;
                            }
                            if (Request.QueryString["clear"] == "Change")
                            {
                                radClear.SelectedValue = "Change";
                                panChange.Visible      = true;
                                panID.Visible          = true;
                            }
                        }
                        DataSet dsWorkstations = oWorkstation.GetVirtualAsset(intAsset);
                        if (dsWorkstations.Tables[0].Rows.Count == 1)
                        {
                            radClear.Items[0].Enabled = false;
                            radClear.Items[0].Text   += " - cannot clear device name for workstations";

                            ddlType.SelectedValue = "-1";
                            int intWorkstation = 0;
                            int intName        = 0;
                            if (Int32.TryParse(dsWorkstations.Tables[0].Rows[0]["id"].ToString(), out intWorkstation) == true)
                            {
                                lblID.Text = intWorkstation.ToString();
                                if (Int32.TryParse(oWorkstation.GetVirtual(intWorkstation, "nameid"), out intName) == true)
                                {
                                    lblNameID.Text         = intName.ToString();
                                    lblName.Text           = oWorkstation.GetName(intName);
                                    lblNew.Text            = lblName.Text;
                                    panWorkstation.Visible = true;

                                    DataSet dsWorkstation = oWorkstation.GetNameId(intName);
                                    if (dsWorkstation.Tables[0].Rows.Count == 1)
                                    {
                                        DataRow drWorkstation = dsWorkstation.Tables[0].Rows[0];

                                        #region WORKSTATION NAMING
                                        // Environment
                                        ddlWorkstationEnvironment.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblWorkstationEnvironment.ClientID + "','WORKSTATION');");
                                        lblWorkstationEnvironment.Text          = drWorkstation["environment"].ToString();
                                        ddlWorkstationEnvironment.SelectedValue = lblWorkstationEnvironment.Text;

                                        // Code
                                        ddlWorkstationCode.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblWorkstationCode.ClientID + "','WORKSTATION');");
                                        lblWorkstationCode.Text          = drWorkstation["code"].ToString();
                                        ddlWorkstationCode.SelectedValue = lblWorkstationCode.Text;

                                        //Sequence
                                        txtWorkstationSequence.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblWorkstationSequence.ClientID + "','WORKSTATION');");
                                        lblWorkstationSequence.Text = drWorkstation["prefix1"].ToString() + drWorkstation["prefix2"].ToString() + drWorkstation["prefix3"].ToString() + drWorkstation["prefix4"].ToString() + drWorkstation["prefix5"].ToString() + drWorkstation["prefix6"].ToString();
                                        txtWorkstationSequence.Text = lblWorkstationSequence.Text;

                                        panButtons.Visible = (Request.QueryString["clear"] != null);
                                        lblNew.Text        = lblWorkstationEnvironment.Text + lblWorkstationCode.Text + lblWorkstationIdentifier.Text + lblWorkstationSequence.Text;
                                        strAdditional     += "ValidateTextLength('" + txtWorkstationSequence.ClientID + "', 'Please enter a valid sequence\\n\\n - Must be exactly 6 characters in length', 6) && ";

                                        #endregion
                                    }
                                }
                                else
                                {
                                    lblError.Text = "Invalid Workstation Name Record(" + oWorkstation.GetVirtual(intWorkstation, "nameid") + ")";
                                }
                            }
                            else
                            {
                                lblError.Text = "Invalid Workstation Record(" + dsWorkstations.Tables[0].Rows[0]["id"].ToString() + ")";
                            }
                        }
                        else
                        {
                            DataSet dsServers = oServer.GetAssetsAsset(intAsset);
                            if (dsServers.Tables[0].Rows.Count == 1)
                            {
                                int intServer = 0;
                                int intName   = 0;
                                if (Int32.TryParse(dsServers.Tables[0].Rows[0]["serverid"].ToString(), out intServer) == true)
                                {
                                    lblID.Text = intServer.ToString();
                                    if (Int32.TryParse(oServer.Get(intServer, "nameid"), out intName) == true)
                                    {
                                        lblNameID.Text = intName.ToString();
                                        lblName.Text   = oServer.GetName(intServer, true);
                                        if (oServer.Get(intServer, "pnc") == "1")
                                        {
                                            ddlType.SelectedValue = "1";
                                            panPNC.Visible        = true;
                                            DataSet dsPNC = oServerName.GetFactory(intName);
                                            if (dsPNC.Tables[0].Rows.Count == 1 || intName == 0)
                                            {
                                                //Operating System
                                                OperatingSystems oOperatingSystem = new OperatingSystems(intProfile, dsn);
                                                DataSet          dsOS             = oOperatingSystem.Gets(0, 1);
                                                DataView         dvOS             = dsOS.Tables[0].DefaultView;
                                                dvOS.RowFilter          = "factory_code <> '' AND factory_code IS NOT NULL";
                                                ddlPNCOS.DataTextField  = "name";
                                                ddlPNCOS.DataValueField = "factory_code";
                                                ddlPNCOS.DataSource     = dvOS;
                                                ddlPNCOS.DataBind();
                                                ddlPNCOS.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCOS.ClientID + "','PNC');");

                                                //Location
                                                Locations oLocation  = new Locations(intProfile, dsn);
                                                DataSet   dsLocation = oLocation.GetAddresss(1);
                                                DataView  dvLocation = dsLocation.Tables[0].DefaultView;
                                                dvLocation.RowFilter          = "factory_code <> 'X' AND factory_code <> '' AND factory_code IS NOT NULL";
                                                ddlPNCLocation.DataTextField  = "commonname";
                                                ddlPNCLocation.DataValueField = "factory_code";
                                                ddlPNCLocation.DataSource     = dvLocation;
                                                ddlPNCLocation.DataBind();
                                                ddlPNCLocation.Items.Add(new ListItem("Other", "X"));
                                                ddlPNCLocation.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCLocation.ClientID + "','PNC');");

                                                //Mnemonic
                                                Variables oVariable = new Variables(intEnvironment);
                                                Mnemonic  oMnemonic = new Mnemonic(intProfile, dsn);
                                                txtPNCMnemonic.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'350','150','" + divPNCMnemonic.ClientID + "','" + lstPNCMnemonic.ClientID + "','" + hdnPNCMnemonic.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_mnemonics.aspx',2);");
                                                lstPNCMnemonic.Attributes.Add("ondblclick", "AJAXClickRow();");
                                                hdnPNCMnemonic.Attributes.Add("onpropertychange", "UpdateNamingMnemonic('" + hdnPNCMnemonic.ClientID + "','" + txtPNCMnemonic.ClientID + "','" + lblPNCMnemonic.ClientID + "','PNC');");

                                                //Environment
                                                Classes  oClass  = new Classes(intProfile, dsn);
                                                DataSet  dsClass = oClass.Gets(1);
                                                DataView dvClass = dsClass.Tables[0].DefaultView;
                                                dvClass.RowFilter = "factory_code <> '' AND factory_code IS NOT NULL";
                                                ddlPNCEnvironment.DataTextField  = "name";
                                                ddlPNCEnvironment.DataValueField = "factory_code";
                                                ddlPNCEnvironment.DataSource     = dvClass;
                                                ddlPNCEnvironment.DataBind();
                                                ddlPNCEnvironment.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCEnvironment.ClientID + "','PNC');");

                                                //Sequence
                                                txtPNCSequence.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblPNCSequence.ClientID + "','PNC');");

                                                //Function
                                                ddlPNCFunction.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCFunction.ClientID + "','PNC');");

                                                //Specific
                                                ddlPNCSpecific.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblPNCSpecific.ClientID + "','PNC');");

                                                #region PNC NAMING
                                                if (intName > 0)
                                                {
                                                    DataRow drPNC = dsPNC.Tables[0].Rows[0];
                                                    //Operating System
                                                    lblPNCOS.Text          = drPNC["os"].ToString();
                                                    ddlPNCOS.SelectedValue = lblPNCOS.Text;
                                                    //Location
                                                    lblPNCLocation.Text          = drPNC["location"].ToString();
                                                    ddlPNCLocation.SelectedValue = lblPNCLocation.Text;
                                                    //Mnemonic
                                                    lblPNCMnemonic.Text = drPNC["mnemonic"].ToString();
                                                    DataSet dsMnemonic  = oMnemonic.Get(lblPNCMnemonic.Text + " - ");
                                                    int     intMnemonic = Int32.Parse(dsMnemonic.Tables[0].Rows[0]["id"].ToString());
                                                    hdnPNCMnemonic.Value = intMnemonic.ToString();
                                                    txtPNCMnemonic.Text  = lblPNCMnemonic.Text + " - " + oMnemonic.Get(intMnemonic, "name");
                                                    //Environment
                                                    lblPNCEnvironment.Text          = drPNC["environment"].ToString();
                                                    ddlPNCEnvironment.SelectedValue = lblPNCEnvironment.Text;
                                                    //Sequence
                                                    lblPNCSequence.Text = drPNC["name1"].ToString() + drPNC["name2"].ToString();
                                                    txtPNCSequence.Text = lblPNCSequence.Text;
                                                    //Function
                                                    lblPNCFunction.Text          = drPNC["func"].ToString();
                                                    ddlPNCFunction.SelectedValue = lblPNCFunction.Text;
                                                    //Specific
                                                    lblPNCSpecific.Text          = drPNC["specific"].ToString();
                                                    ddlPNCSpecific.SelectedValue = lblPNCSpecific.Text;
                                                }
                                                else
                                                {
                                                    //Operating System
                                                    ddlPNCOS.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCOS.ClientID + "','Please select an Operating System') && ";
                                                    //Location
                                                    ddlPNCLocation.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCLocation.ClientID + "','Please select a Location') && ";
                                                    //Mnemonic
                                                    strAdditional += "ValidateHidden0('" + hdnPNCMnemonic.ClientID + "','" + txtPNCMnemonic.ClientID + "','Please enter the mnemonic') && ";
                                                    //Environment
                                                    ddlPNCEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCEnvironment.ClientID + "','Please select an Environment') && ";
                                                    //Sequence - Done down below
                                                    //Function
                                                    ddlPNCFunction.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCFunction.ClientID + "','Please select a Function') && ";
                                                    //Specific
                                                    ddlPNCSpecific.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlPNCSpecific.ClientID + "','Please select an Option') && ";
                                                }

                                                panButtons.Visible = (Request.QueryString["clear"] != null);
                                                lblNew.Text        = lblPNCOS.Text + lblPNCLocation.Text + lblPNCMnemonic.Text + lblPNCEnvironment.Text + lblPNCSequence.Text + lblPNCFunction.Text + lblPNCSpecific.Text;
                                                strAdditional     += "ValidateTextLength('" + txtPNCSequence.ClientID + "', 'Please enter a valid sequence\\n\\n - Must be exactly 2 characters in length', 2) && ";

                                                #endregion
                                            }
                                            else
                                            {
                                                lblError.Text = "PNC Names (" + dsPNC.Tables[0].Rows.Count.ToString() + ")";
                                            }
                                        }
                                        else
                                        {
                                            ddlType.SelectedValue = "0";
                                            panNCB.Visible        = true;
                                            DataSet dsNCB = oServerName.Get(intName);
                                            if (dsNCB.Tables[0].Rows.Count == 1 || intName == 0)
                                            {
                                                //State
                                                txtNCBState.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblNCBState.ClientID + "','NCB');");

                                                //City
                                                txtNCBCity.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblNCBCity.ClientID + "','NCB');");

                                                //Function
                                                DataSet  dsFunction = oServerName.GetFunctions();
                                                DataView dvFunction = dsFunction.Tables[0].DefaultView;
                                                dvFunction.RowFilter          = "code <> '' AND code IS NOT NULL";
                                                ddlNCBFunction.DataTextField  = "name";
                                                ddlNCBFunction.DataValueField = "code";
                                                ddlNCBFunction.DataSource     = dvFunction;
                                                ddlNCBFunction.DataBind();
                                                ddlNCBFunction.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblNCBFunction.ClientID + "','NCB');");

                                                //SiteCode
                                                ddlNCBSiteCode.Attributes.Add("onchange", "UpdateNamingDDL(this,'" + lblNCBSiteCode.ClientID + "','NCB');");

                                                //Sequence
                                                txtNCBSequence.Attributes.Add("onblur", "UpdateNamingText(this,'" + lblNCBSequence.ClientID + "','NCB');");

                                                #region NCB NAMING
                                                if (intName > 0)
                                                {
                                                    DataRow drNCB      = dsNCB.Tables[0].Rows[0];
                                                    string  strPrefix  = drNCB["prefix1"].ToString();
                                                    string  strPrefix1 = strPrefix.Substring(0, 2);
                                                    string  strPrefix2 = strPrefix.Substring(2, 3);
                                                    //State
                                                    lblNCBState.Text = strPrefix1;
                                                    txtNCBState.Text = lblNCBState.Text;
                                                    //City
                                                    lblNCBCity.Text = strPrefix2;
                                                    txtNCBCity.Text = lblNCBCity.Text;
                                                    //Function
                                                    lblNCBFunction.Text          = drNCB["prefix2"].ToString();
                                                    ddlNCBFunction.SelectedValue = lblNCBFunction.Text;
                                                    //SiteCode
                                                    lblNCBSiteCode.Text          = drNCB["sitecode"].ToString();
                                                    ddlNCBSiteCode.SelectedValue = lblNCBSiteCode.Text;
                                                    //Sequence
                                                    lblNCBSequence.Text = drNCB["name1"].ToString() + drNCB["name2"].ToString();
                                                    txtNCBSequence.Text = lblNCBSequence.Text;
                                                }
                                                else
                                                {
                                                    //State - Done down below
                                                    //City - Done down below
                                                    //Function
                                                    ddlNCBFunction.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlNCBFunction.ClientID + "','Please select a Function') && ";
                                                    //SiteCode
                                                    ddlNCBSiteCode.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                                                    strAdditional += "ValidateDropDown('" + ddlNCBSiteCode.ClientID + "','Please select a Site Code') && ";
                                                    //Sequence - Done down below
                                                }

                                                panButtons.Visible = (Request.QueryString["clear"] != null);
                                                lblNew.Text        = lblNCBState.Text + lblNCBCity.Text + lblNCBFunction.Text + lblNCBSiteCode.Text + lblNCBSequence.Text;
                                                strAdditional     += "ValidateTextLength('" + txtNCBState.ClientID + "', 'Please enter a valid state\\n\\n - Must be exactly 2 characters in length', 2) && ";
                                                strAdditional     += "ValidateTextLength('" + txtNCBCity.ClientID + "', 'Please enter a valid city\\n\\n - Must be exactly 3 characters in length', 3) && ";
                                                strAdditional     += "ValidateTextLength('" + txtNCBSequence.ClientID + "', 'Please enter a valid sequence\\n\\n - Must be exactly 2 characters in length', 2) && ";

                                                #endregion
                                            }
                                            else
                                            {
                                                lblError.Text = "NCB Names (" + dsNCB.Tables[0].Rows.Count.ToString() + ")";
                                            }
                                        }
                                    }
                                    else
                                    {
                                        lblError.Text = "Invalid Server Name Record(" + oServer.Get(intServer, "nameid") + ")";
                                    }
                                }
                                else
                                {
                                    lblError.Text = "Invalid Server Record(" + dsServers.Tables[0].Rows[0]["serverid"].ToString() + ")";
                                }
                            }
                            else
                            {
                                if (dsWorkstations.Tables[0].Rows.Count > 1)
                                {
                                    lblError.Text = "Workstations (" + dsWorkstations.Tables[0].Rows.Count.ToString() + ")";
                                }
                                else if (dsServers.Tables[0].Rows.Count > 1)
                                {
                                    lblError.Text = "Servers (" + dsServers.Tables[0].Rows.Count.ToString() + ")";
                                }
                                else
                                {
                                    radClear.Items[1].Enabled = false;
                                    panButtons.Visible        = (Request.QueryString["clear"] != null);
                                    //lblError.Text = "Asset Not Found";
                                }
                            }
                        }
                        if (lblName.Text == "")
                        {
                            lblName.Text = "---";
                        }
                        else
                        {
                            lblNew.CssClass = (lblNew.Text == lblName.Text ? "header" : "redheader");
                        }
                        if (panChange.Visible == true)
                        {
                            btnSubmit.Attributes.Add("onclick", "return " + strAdditional + " IsOKtoChange() && confirm('WARNING: This will permanently change the device name and release the previous name for re-use (if applicable)!\\n\\nAre you sure you want to continue?') && ProcessButton(this,'Changing...','100');");
                        }
                        if (panClear.Visible == true)
                        {
                            btnSubmit.Attributes.Add("onclick", "return confirm('WARNING: This will permanently clear the device name and release it for re-use (if applicable)!\\n\\nAre you sure you want to continue?') && ProcessButton(this,'Clearing...','100');");
                        }
                        btnReset.Attributes.Add("onclick", "return IsOKtoReset(this);");
                        btnAlreadyChange.Attributes.Add("onclick", "return confirm('LAST CHANCE! This will permanently change the device name and release the previous name for re-use (if applicable)!\\n\\nAre you sure you want to continue?') && ProcessButton(this,'Changing...','100');");
                    }
                    else
                    {
                        lblError.Text = "Either the asset or the status of the asset could not be identified";
                    }
                }
            }
            else
            {
                lblError.Text = "Either the asset or the status of the asset could not be identified";
            }
            if (lblError.Text != "" && boolMessage == false)
            {
                panError.Visible  = true;
                panClear.Visible  = false;
                btnSubmit.Enabled = false;
            }
        }
Exemple #13
0
        public void SystemError(int _serverid, int _workstationid, int _stepid, string _error, int _assetid, int _modelid, bool _is_vmware, VMWare _vmware, int _environment, string _dsn_asset)
        {
            int intError = 0;

            if (_stepid > 0)
            {
                string   strName   = "";
                string   strType   = "";
                int      intID     = 0;
                OnDemand oOnDemand = new OnDemand(0, dsn);
                if (_serverid > 0)
                {
                    oOnDemand.UpdateStepDoneServer(_serverid, _stepid, _error, 1, false, false);
                    Servers oServer = new Servers(0, dsn);
                    intError = oServer.AddError(0, 0, 0, _serverid, _stepid, _error);
                    strName  = oServer.GetName(_serverid, true);
                    strType  = "server";
                    intID    = _serverid;
                }
                if (_workstationid > 0)
                {
                    oOnDemand.UpdateStepDoneWorkstation(_workstationid, _stepid, _error, 1, false, false);
                    Workstations oWorkstation = new Workstations(0, dsn);
                    intError = oWorkstation.AddVirtualError(0, 0, 0, _workstationid, _stepid, _error);
                    int intName = 0;
                    if (Int32.TryParse(oWorkstation.GetVirtual(_workstationid, "nameid"), out intName) == true)
                    {
                        strName = oWorkstation.GetName(intName);
                    }
                    strType = "workstation";
                    intID   = _workstationid;
                }
                if (_serverid > 0 || _workstationid > 0)
                {
                    ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
                    Functions        oFunction         = new Functions(0, dsn, _environment);
                    Variables        oVariable         = new Variables(_environment);
                    Asset            oAsset            = new Asset(0, _dsn_asset);

                    int     intType = oModelsProperties.GetType(_modelid);
                    DataSet dsSteps = oOnDemand.GetSteps(intType, 1);
                    string  strStep = "N / A";
                    if (dsSteps.Tables[0].Rows.Count > 0)
                    {
                        strStep = dsSteps.Tables[0].Rows[_stepid - 1]["name"].ToString();
                    }
                    string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_SUPPORT");
                    try
                    {
                        if (_is_vmware == true)
                        {
                            oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>DataCenter: " + _vmware.DataCenter() + "<br/>Virtual Center: " + _vmware.VirtualCenter() + "</p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                        }
                        else
                        {
                            oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>ILO: <a href=\"https://" + oAsset.GetServerOrBlade(_assetid, "ilo") + "\" target=\"_blank\">" + oAsset.GetServerOrBlade(_assetid, "ilo") + "</a></p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        oFunction.SendEmail("Auto-Provisioning FATAL ERROR: " + strName, strEMailIdsBCC, "", "", "Auto-Provisioning FATAL ERROR: " + strName, "<p><b>This message is to inform you that the " + strType + " " + strName + " has encountered a FATAL error and has been stopped!</b><p><p>Serial Number: " + oAsset.Get(_assetid, "serial").ToUpper() + "<br/>Asset Tag: " + oAsset.Get(_assetid, "asset").ToUpper() + "<br/>Model: " + oModelsProperties.Get(_modelid, "name").ToUpper() + "<br/>Step #: " + _stepid.ToString() + "<br/>Step: " + strStep + "<br/>Error: " + _error + "<br/>Notification Error: (Error Message: " + ex.Message + ") (Source: " + ex.Source + ") (Stack Trace: " + ex.StackTrace + ")</p><p>When this issue has been resolved, <a href=\"" + oVariable.URL() + "/admin/errors_" + strType + ".aspx?id=" + intID.ToString() + "\" target=\"_blank\">click here</a> to clear this error and continue with the build.</p>", true, false);
                    }
                }
            }
            UpdateError(_error);
        }
Exemple #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oWorkstation      = new Workstations(intProfile, dsn);
            oStorage          = new Storage(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oOperatingSystem  = new OperatingSystems(intProfile, dsn);
            if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "")
            {
                intAnswer = Int32.Parse(Request.QueryString["aid"]);
            }
            if (Request.QueryString["num"] != null && Request.QueryString["num"] != "")
            {
                intNumber = Int32.Parse(Request.QueryString["num"]);
            }
            int intWorkstation = 0;

            if (intAnswer > 0)
            {
                DataSet ds = oForecast.GetAnswer(intAnswer);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int intModel = oForecast.GetModel(intAnswer);
                    intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    int _classid = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                    intQuantity = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
                    int _environmentid = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString());
                    intOS      = Int32.Parse(oForecast.GetWorkstation(intAnswer, "osid"));
                    intRequest = oForecast.GetRequestID(intAnswer, true);
                    if (!IsPostBack)
                    {
                        LoadLists(_classid, _environmentid);
                        chkApply.Visible = (intQuantity > 1 && intNumber == 1);
                        ds = oWorkstation.GetVirtual(intAnswer, intNumber);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            intWorkstation = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                            lblId.Text     = intWorkstation.ToString();
                            intOS          = Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString());
                        }
                        if (intOS > 0)
                        {
                            ddlOS.SelectedValue           = intOS.ToString();
                            ddlServicePack.Enabled        = true;
                            ddlServicePack.DataValueField = "id";
                            ddlServicePack.DataTextField  = "name";
                            ddlServicePack.DataSource     = oOperatingSystem.GetServicePack(intOS);
                            ddlServicePack.DataBind();
                            ddlServicePack.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                            chkComponents.DataValueField = "id";
                            chkComponents.DataTextField  = "name";
                            chkComponents.DataSource     = oWorkstation.GetComponentPermissionsOS(intOS);
                            chkComponents.DataBind();
                            DataSet dsComponents = oWorkstation.GetComponentsSelected(intWorkstation);
                            foreach (DataRow drComponent in dsComponents.Tables[0].Rows)
                            {
                                foreach (ListItem oItem in chkComponents.Items)
                                {
                                    if (drComponent["componentid"].ToString() == oItem.Value)
                                    {
                                        oItem.Selected = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            ddlServicePack.SelectedValue = ds.Tables[0].Rows[0]["spid"].ToString();
                            hdnServicePack.Value         = ds.Tables[0].Rows[0]["spid"].ToString();
                            ddlDomain.SelectedValue      = ds.Tables[0].Rows[0]["domainid"].ToString();
                        }
                    }
                    btnClose.Attributes.Add("onclick", "return window.close();");
                    btnSaveConfig.Attributes.Add("onclick", "return ValidateDropDown('" + ddlServicePack.ClientID + "','Please select a service pack')" +
                                                 " && ValidateDropDown('" + ddlDomain.ClientID + "','Please select a domain')" +
                                                 ";");
                    ddlOS.Attributes.Add("onchange", "PopulateServicePacks('" + ddlOS.ClientID + "','" + ddlServicePack.ClientID + "');");
                    ddlServicePack.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlServicePack.ClientID + "','" + hdnServicePack.ClientID + "');");
                }
            }
        }
Exemple #15
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();");
        }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            StringBuilder sb = new StringBuilder(strAccounts);

            Page.Title = strTitle;
            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\">alert('Approval has been submitted');<" + "/" + "script>");
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID = Int32.Parse(Request.QueryString["id"]);
                Workstations oWorkstation = new Workstations(intProfile, dsn);
                Forecast     oForecast    = new Forecast(intProfile, dsn);
                Users        oUser        = new Users(intProfile, dsn);
                Asset        oAsset       = new Asset(intProfile, dsnAsset);
                int          intAnswer    = Int32.Parse(oWorkstation.GetVirtual(intID, "answerid"));
                if (Int32.Parse(oForecast.GetAnswer(intAnswer, "appcontact")) == intProfile)
                {
                    panPermit.Visible = true;
                    int intAsset = Int32.Parse(oWorkstation.GetVirtual(intID, "assetid"));
                    lblName.Text    = oAsset.Get(intAsset, "name");
                    lblManager.Text = oUser.GetFullName(intProfile);
                    DataSet ds = oWorkstation.GetAccountsVirtual(intAsset);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        sb.Append("<tr>");
                        sb.Append("<td>");
                        sb.Append(oUser.GetFullName(Int32.Parse(dr["userid"].ToString())));
                        sb.Append("</td>");

                        string strRights = "";
                        if (dr["remote"].ToString() == "1")
                        {
                            strRights = "Remote Access";
                        }
                        if (dr["admin"].ToString() == "1")
                        {
                            if (strRights != "")
                            {
                                strRights += ", ";
                            }
                            strRights += "Administrator";
                        }
                        sb.Append("<td>");
                        sb.Append(strRights);
                        sb.Append("</td>");
                        sb.Append("<td align=\"center\"><input type=\"radio\" name=\"approve");
                        sb.Append(dr["id"].ToString());
                        sb.Append("\" onclick=\"ApproveCheckBox(this, '");
                        sb.Append(dr["id"].ToString());
                        sb.Append("','");
                        sb.Append(hdnApprove.ClientID);
                        sb.Append("');\"/></td>");
                        sb.Append("<td align=\"center\"><input type=\"radio\" name=\"approve");
                        sb.Append(dr["id"].ToString());
                        sb.Append("\" onclick=\"ApproveCheckBox(this, '");
                        sb.Append(dr["id"].ToString());
                        sb.Append("','");
                        sb.Append(hdnDeny.ClientID);
                        sb.Append("');\"/></td>");
                        sb.Append("</tr>");
                    }

                    if (sb.ToString() == "")
                    {
                        sb.Append("<tr><td colspan=\"4\"><img src=\"/images/alert.gif\" border=\"0\" align=\"absmiddle\"/> There are no accounts</td></tr>");
                        btnSave.Enabled = false;
                    }
                }
                else
                {
                    panDenied.Visible = true;
                }
            }

            strAccounts = sb.ToString();
            btnSave.Attributes.Add("onclick", "return confirm('WARNING: The accounts you have approved will automatically be added to the appropriate groups.\\n\\nAre you sure you want to continue?');");
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            Control oControl = (Control)LoadControl("/controls/sys/sys_rotator_header.ascx");

            PH4.Controls.Add(oControl);
        }
Exemple #17
0
        protected void btnSave_Click(Object Sender, EventArgs e)
        {
            string       strGroupRemote = "GSGu_WKS" + lblName.Text + "RemoteA";
            string       strGroupAdmin  = "GSGu_WKS" + lblName.Text + "Adm";
            bool         bool2000       = (lblName.Text.ToUpper().StartsWith("T2K") == true || lblName.Text.ToUpper().StartsWith("W2K") == true);
            Workstations oWorkstation   = new Workstations(intProfile, dsn);
            Users        oUser          = new Users(intProfile, dsn);
            Domains      oDomain        = new Domains(intProfile, dsn);
            int          intDomain      = Int32.Parse(oWorkstation.GetVirtual(intID, "domainid"));

            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD     oAD       = new AD(intProfile, dsn, intDomain);
            string strHidden = Request.Form[hdnApprove.UniqueID];

            while (strHidden != "")
            {
                string strField = strHidden.Substring(0, strHidden.IndexOf("&"));
                strHidden = strHidden.Substring(strHidden.IndexOf("&") + 1);
                string strFlag = strField.Substring(strField.IndexOf("_") + 1);
                strField = strField.Substring(0, strField.IndexOf("_"));
                if (strFlag == "1")
                {
                    int     intAccount = Int32.Parse(strField);
                    DataSet ds         = oWorkstation.GetAccount(intAccount);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        int    intUser = Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString());
                        string strID   = oUser.GetName(intUser);
                        if (intDomain != (int)CurrentEnvironment.CORPDMN && intDomain != (int)CurrentEnvironment.PNCNT_PROD)
                        {
                            strID = "E" + strID.Substring(1);
                            if (oAD.Search(strID, false) == null)
                            {
                                strID = "T" + strID.Substring(1);
                                if (oAD.Search(strID, false) == null)
                                {
                                    oAD.CreateUser(strID, strID, strID, "Abcd1234", "", "Created by ClearView - " + DateTime.Now.ToShortDateString(), "");
                                }
                            }
                            if (ds.Tables[0].Rows[0]["admin"].ToString() == "1")
                            {
                                oAD.JoinGroup(strID, strGroupAdmin, 0);
                            }
                        }
                        if (ds.Tables[0].Rows[0]["remote"].ToString() == "1" && bool2000 == false)
                        {
                            oAD.JoinGroup(strID, strGroupRemote, 0);
                        }
                    }
                    oWorkstation.UpdateAccount(intAccount);
                }
            }
            strHidden = Request.Form[hdnDeny.UniqueID];
            while (strHidden != "")
            {
                string strField = strHidden.Substring(0, strHidden.IndexOf("&"));
                strHidden = strHidden.Substring(strHidden.IndexOf("&") + 1);
                string strFlag = strField.Substring(strField.IndexOf("_") + 1);
                strField = strField.Substring(0, strField.IndexOf("_"));
                if (strFlag == "1")
                {
                    int intAccount = Int32.Parse(strField);
                    oWorkstation.UpdateAccount(intAccount);
                }
            }
        }