protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oWorkstation      = new Workstations(intProfile, dsn);
     oOperatingSystems = new OperatingSystems(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intComponent = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         Load(null);
         if (intComponent > 0)
         {
             lblName.Text = oWorkstation.GetComponent(intComponent, "name");
         }
     }
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/errors_workstation.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oWorkstation = new Workstations(intProfile, dsn);
     oUser        = new Users(intProfile, dsn);
     oZeus        = new Zeus(intProfile, dsnZeus);
     oAsset       = new Asset(0, dsnAsset);
     oOnDemand    = new OnDemand(intProfile, dsn);
     oError       = new Errors(intProfile, dsn);
     oIncident    = new Incident(intProfile, dsn);
     oFunction    = new Functions(intProfile, dsn, intEnvironment);
     oVariable    = new Variables(intEnvironment);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
         if (!IsPostBack)
         {
             LoadList();
         }
         LoadErrors();
     }
     else if (!IsPostBack)
     {
         LoadWorkstations();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Workstations oWorkstation = new Workstations(0, dsn);

            if (Request.QueryString["u"] != null && Request.QueryString["u"] == "GET")
            {
                string strResponse = "";
                try
                {
                    XmlDocument oDoc = new XmlDocument();
                    oDoc.Load(Request.InputStream);
                    Response.ContentType = "application/xml";
                    strResponse          = "<values>";
                    int    intWorkstation = Int32.Parse(oDoc.ChildNodes[0].ChildNodes[0].InnerText);
                    string strStep        = oDoc.ChildNodes[0].ChildNodes[1].InnerText;
                    int    intStep        = oWorkstation.GetVirtualStep(intWorkstation);
                    if (intStep.ToString() == strStep)
                    {
                        strResponse += "<value>0</value>";
                    }
                    else
                    {
                        strResponse += "<value>1</value>";
                    }
                    strResponse += "</values>";
                }
                catch { }
                Response.Write(strResponse);
                Response.End();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage      = new Pages(intProfile, dsn);
            oService   = new Services(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);
            }
            int intRequest = 0;

            Int32.TryParse(Request.QueryString["rid"], out intRequest);
            int intService = 0;

            Int32.TryParse(Request.QueryString["cid"], out intService);
            int intNumber = 0;

            Int32.TryParse(Request.QueryString["num"], out intNumber);
            int intItem = oService.GetItemId(intService);
            // *****************************************************************************
            // ********* Additional Cancel Functionality to be performed here **************
            // *****************************************************************************
            Workstations oWorkstation = new Workstations(intProfile, dsn);
            DateTime     datOff       = DateTime.Today;
            // Get from manaul table
            DataSet dsRebuild = oWorkstation.GetVirtualRebuild(intRequest, intService, intNumber);

            foreach (DataRow drRebuild in dsRebuild.Tables[0].Rows)
            {
                if (drRebuild["cancelled"].ToString() == "")
                {
                    DateTime.TryParse(drRebuild["scheduled"].ToString(), out datOff);
                    break;
                }
            }

            if (datOff > DateTime.Now)
            {
                // Cancel automated table
                oWorkstation.UpdateVirtualRebuildCancel(intRequest, intService, intNumber);
            }
            // *****************************************************************************
            // ********* END of Additional Cancel Functionality  ***************************
            // *****************************************************************************
            Page.ClientScript.RegisterStartupScript(typeof(Page), "cancelled", "<script type=\"text/javascript\">ExecuteCancel('" + oService.GetName(intService) + "','" + oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString() + "');<" + "/" + "script>");
        }
예제 #5
0
파일: Service.cs 프로젝트: radtek/ClearView
        private void CheckServices()
        {
            DateTime now = DateTime.Now;

            string[] times  = strRestartTime.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            bool     timeOK = false;

            foreach (string time in times)
            {
                if (String.IsNullOrEmpty(time) == false)
                {
                    if (intLogging >= 3)
                    {
                        oEventLog.WriteEntry(String.Format("Checking Restart Time = " + time), EventLogEntryType.Information);
                    }

                    DateTime _tick = DateTime.Parse(time.Trim());
                    if (_tick.ToShortTimeString() == now.ToShortTimeString())
                    {
                        timeOK = true;
                        if (intLogging >= 2)
                        {
                            oEventLog.WriteEntry(String.Format("Time = " + time + " is Valid!"), EventLogEntryType.Information);
                        }
                        break;
                    }
                    else if (intLogging >= 3)
                    {
                        oEventLog.WriteEntry(String.Format("Time = " + time + " is not valid (" + now.ToShortTimeString() + ")"), EventLogEntryType.Warning);
                    }
                }
            }

            if (timeOK)
            {
                Servers      oServer      = new Servers(0, dsn);
                Workstations oWorkstation = new Workstations(0, dsn);

                List <ServiceData> Data         = new List <ServiceData>();
                string[]           strTypeSplit = { "," };
                Data.Add(new ServiceData("ClearView AP Physical", oServer.GetScheduler(PhysicalTypes), PhysicalSteps.Split(strTypeSplit, StringSplitOptions.RemoveEmptyEntries), "servername"));
                Data.Add(new ServiceData("ClearView AP VMware", oServer.GetScheduler(VirtualTypes), VirtualSteps.Split(strTypeSplit, StringSplitOptions.RemoveEmptyEntries), "servername"));
                Data.Add(new ServiceData("ClearView AP VMware Workstation", oWorkstation.GetScheduler(WorkstationType), WorkstationSteps.Split(strTypeSplit, StringSplitOptions.RemoveEmptyEntries), "workstationname"));
                foreach (ServiceData data in Data)
                {
                    CheckService oCheckService       = new CheckService(data.ServiceName, data.CurrentBuilds, data.ExcludeSteps, data.ColumnName, intRestartHours, intStartTimeout, dsn, intEnvironment, intLogging, oEventLog);
                    ThreadStart  oCheckServiceStart  = new ThreadStart(oCheckService.Begin);
                    Thread       oCheckServiceThread = new Thread(oCheckServiceStart);
                    oCheckServiceThread.Start();
                }
            }
        }
예제 #6
0
        //Delete Guest without decommission
        protected void btnDeleteWOdecommissionGuest_Click(object sender, EventArgs e)
        {
            Workstations oWorkstation = new Workstations(intProfile, dsn);

            foreach (TreeNode node in tvVirtualHostnGuests.CheckedNodes)
            {
                int intID = Int32.Parse(node.Value.ToString());
                oWorkstation.DeleteVirtual(intID);
            }

            Response.Redirect(oPage.GetFullLink(intPage) + "?id=" + intId + "&div=X");
            //LoadControls();
        }
 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);
     oWorkstation = new Workstations(intProfile, dsn);
     oApplication = new Applications(intProfile, dsn);
     oForecast    = new Forecast(intProfile, dsn);
     oFunction    = new Functions(intProfile, dsn, intEnvironment);
     oUser        = new Users(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)
     {
         LoadValues();
         int    intItem        = Int32.Parse(lblItem.Text);
         int    intService     = Int32.Parse(lblService.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["n"] != null && Request.QueryString["n"] != "")
         {
             if (!IsPostBack)
             {
                 LoadWorkstation();
             }
         }
         else if (Request.QueryString["formid"] == null || Request.QueryString["formid"] == "")
         {
             btnNext.Enabled = false;
         }
         btnContinue.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a workstation name') && ProcessButton(this) && LoadWait();");
     }
     btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this service request?');");
     imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
 }
예제 #8
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>");
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/workstation_components.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oWorkstation = new Workstations(intProfile, dsn);
     if (Request.QueryString["id"] == null)
     {
         if (Request.QueryString["add"] == null)
         {
             LoopRepeater();
         }
         else
         {
             panAdd.Visible = true;
         }
     }
     else
     {
         panAdd.Visible = true;
         intID          = Int32.Parse(Request.QueryString["id"]);
         if (intID > 0 && !IsPostBack)
         {
             DataSet ds = oWorkstation.GetComponent(intID);
             txtName.Text             = ds.Tables[0].Rows[0]["name"].ToString();
             txtZEUSBuildType.Text    = ds.Tables[0].Rows[0]["zeus_build_type"].ToString();
             txtADMoveLocation.Text   = ds.Tables[0].Rows[0]["ad_move_location"].ToString();
             chkSMSInstall.Checked    = (ds.Tables[0].Rows[0]["sms_install"].ToString() == "1");
             txtScript.Text           = ds.Tables[0].Rows[0]["script"].ToString();
             txtWorkstationGroup.Text = ds.Tables[0].Rows[0]["workstation_group"].ToString();
             txtUserGroup.Text        = ds.Tables[0].Rows[0]["user_group"].ToString();
             txtNotifications.Text    = ds.Tables[0].Rows[0]["notifications"].ToString();
             chkEnabled.Checked       = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
         }
     }
     btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=WORKSTATION_C" + "',false,400,400);");
     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
     btnOS.Attributes.Add("onclick", "return OpenWindow('WORKSTATION_COMPONENTS','" + hdnId.ClientID + "','',false,'500',300);");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/workstation_components_scripts.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oWorkstation = new Workstations(intProfile, dsn);
     if (Request.QueryString["id"] == null)
     {
         if (Request.QueryString["parent"] == null)
         {
             LoadComponents();
         }
         else
         {
             panAdd.Visible = true;
             int intParent = Int32.Parse(Request.QueryString["parent"]);
             hdnParent.Value = intParent.ToString();
             lblParent.Text  = oWorkstation.GetComponent(intParent, "name");
         }
     }
     else
     {
         panAdd.Visible = true;
         intID          = Int32.Parse(Request.QueryString["id"]);
         if (!IsPostBack)
         {
             DataSet ds        = oWorkstation.GetComponentScript(intID);
             int     intParent = Int32.Parse(ds.Tables[0].Rows[0]["componentid"].ToString());
             hdnParent.Value    = intParent.ToString();
             lblParent.Text     = oWorkstation.GetComponent(intParent, "name");
             txtName.Text       = ds.Tables[0].Rows[0]["name"].ToString();
             txtScript.Text     = ds.Tables[0].Rows[0]["script"].ToString();
             chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
         }
     }
     btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnParent.ClientID + "','" + hdnOrder.ClientID + "&type=COMPONENT_SCRIPTS" + "',false,400,400);");
     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
 }
예제 #11
0
        //decommission Guest
        protected void btnDecommissionGuests_Click(object sender, EventArgs e)
        {
            Asset        oAsset       = new Asset(intProfile, dsnAsset);
            Workstations oRemote      = new Workstations(intProfile, dsnRemote);
            Workstations oWorkstation = new Workstations(intProfile, dsn);
            Domains      oDomain      = new Domains(intProfile, dsn);

            foreach (TreeNode node in tvVirtualHostnGuests.CheckedNodes)
            {
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    if (dr["id"].ToString() == node.Value.ToString())
                    {
                        int     intID         = Int32.Parse(dr["id"].ToString());
                        int     intName       = Int32.Parse(dr["nameid"].ToString());
                        string  strName       = oWorkstation.GetName(intName);
                        int     intHost       = Int32.Parse(dr["virtualhostid"].ToString());
                        int     intAsset      = Int32.Parse(dr["assetid"].ToString());
                        int     intOS         = Int32.Parse(dr["osid"].ToString());
                        string  strHost       = oAsset.GetServerOrBlade(intHost, "name");
                        string  strVirtualDir = "";
                        DataSet dsOS          = oAsset.GetVirtualHostOs(intHost);
                        foreach (DataRow drOS in dsOS.Tables[0].Rows)
                        {
                            if (Int32.Parse(drOS["osid"].ToString()) == intOS)
                            {
                                strVirtualDir = drOS["virtualdir"].ToString();
                                break;
                            }
                        }
                        int intDomain = Int32.Parse(dr["domainid"].ToString());
                        int intEnv    = Int32.Parse(oDomain.Get(intDomain, "environment"));
                        oRemote.AddRemoteVirtualDecom(intEnv, strHost, strVirtualDir, strName);
                        // Clean up database
                        oWorkstation.DeleteVirtual(intID);
                        oWorkstation.UpdateName(intName, 1);
                        oAsset.DeleteGuest(intAsset);
                        oAsset.AddStatus(intAsset, "", (int)AssetStatus.Decommissioned, intProfile, DateTime.Now);
                    }
                }
            }
            Response.Redirect(oPage.GetFullLink(intPage) + "?id=" + intId + "&div=X");
            //LoadControls();
        }
 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);
     oWorkstation = new Workstations(intProfile, dsn);
     oCustomized  = new Customized(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 + "');");
         }
         Variables oVariable = new Variables(intEnvironment);
         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','');");
     }
     btnCancel1.Attributes.Add("onclick", "return confirm('Are you sure you want to cancel this service request?');");
 }
예제 #13
0
 public Service()
 {
     InitializeComponent();
     CoInitializeSecurity(IntPtr.Zero,
                          -1,
                          IntPtr.Zero,
                          IntPtr.Zero,
                          (uint)RpcAuthnLevel.None,
                          (uint)RpcImpLevel.Impersonate,
                          IntPtr.Zero,
                          (uint)EoAuthnCap.None,
                          IntPtr.Zero);
     try
     {
         if (EventLog.SourceExists("ClearView") == false)
         {
             EventLog.CreateEventSource("ClearView", "ClearView");
             EventLog.WriteEntry(String.Format("ClearView EventLog Created"), EventLogEntryType.Information);
         }
         oLog        = new EventLog();
         oLog.Source = "ClearView";
         oLog.ModifyOverflowPolicy(OverflowAction.OverwriteAsNeeded, 0);
         oLog.MaximumKilobytes = long.Parse("16384");
         DataSet ds = new DataSet();
         ds.ReadXml(strScripts + "config.xml");
         dblInterval     = Convert.ToDouble(ds.Tables[0].Rows[0]["interval"].ToString());
         dsnRemote       = ds.Tables[0].Rows[0]["remoteDSN"].ToString();
         strNetwork      = ds.Tables[0].Rows[0]["network"].ToString();
         intLogging      = Int32.Parse(ds.Tables[0].Rows[0]["logging"].ToString());
         boolProduction  = (ds.Tables[0].Rows[0]["prod"].ToString() == "1");
         oWorkstation    = new Workstations(0, dsnRemote);
         oTimer          = new System.Timers.Timer(dblInterval);
         oTimer.Elapsed += new ElapsedEventHandler(this.ServiceTimer_Tick);
     }
     catch
     {
         EventLog.WriteEntry(String.Format("ClearView Virtual Workstation Service initialization has failed - INVALID XML FILE"), EventLogEntryType.Error);
     }
 }
예제 #14
0
 private void AddAction()
 {
     ValidationWorkstation.Validate(EPages.WORKSTATION);
     if (ValidationWorkstation.IsValid)
     {
         if (!workstationService.SaveWorkstation(ValidationWorkstation, userService.GetCurrentUser().UserId))
         {
             ValidationWorkstation.ValidationErrors["Name"] = "You already used this name.";
             ValidationWorkstation.ValidationPropertyChange();
         }
         else
         {
             Workstations.Add(new Workstation
             {
                 WorkstationId = ValidationWorkstation.WorkstationId,
                 Name          = ValidationWorkstation.Name,
                 CreationDate  = ValidationWorkstation.CreationDate,
             });
             ValidationWorkstation.Name = "";
         }
     }
 }
예제 #15
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;
            }
        }
예제 #16
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();");
        }
예제 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oVariable         = new Variables(intEnvironment);
            oWorkstation      = new Workstations(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oServiceRequest   = new ServiceRequests(intProfile, dsn);
            oLocation         = new Locations(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);
            oClass            = new Classes(intProfile, dsn);
            oAD = new AD(intProfile, dsn, intEnvironment);

            //Menus
            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("Pool Configurtion", "");
            oTab.AddTab("Workstation History", "");
            oTab.AddTab("Workstations Currently Available", "");
            oTab.AddTab("Subscribed Users", "");
            strMenuTab1 = oTab.GetTabs();

            //End Menus

            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);
            }
            lblTitle.Text = oPage.Get(intPage, "title");
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                panPool.Visible = true;
                int intID = Int32.Parse(Request.QueryString["id"]);
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                DataSet ds = oWorkstation.GetPool(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string strName = ds.Tables[0].Rows[0]["name"].ToString();
                    txtName.Text          = strName;
                    rptHistory.DataSource = oWorkstation.GetPoolWorkstationsStatus(strName);
                    rptHistory.DataBind();
                    lblHistory.Visible      = (rptHistory.Items.Count == 0);
                    rptAvailable.DataSource = oWorkstation.GetPoolWorkstations(strName);
                    rptAvailable.DataBind();
                    lblAvailable.Visible = (rptAvailable.Items.Count == 0);
                    DirectoryEntry oEntry = oAD.GroupSearch("GSGwra_" + strName);
                    if (oEntry != null)
                    {
                        if (oEntry.Properties.Contains("member") == true)
                        {
                            foreach (string strUser in oEntry.Properties["member"])
                            {
                                DirectoryEntry oEntry2 = new DirectoryEntry("LDAP://" + oVariable.primaryDCName(dsn) + "/" + strUser, oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword());
                                strSubscribers += "<tr><td>" + oEntry2.Properties["displayname"].Value.ToString() + " (" + oEntry2.Properties["name"].Value.ToString() + ")</td></tr>";
                            }
                        }
                        else
                        {
                            strSubscribers += "<tr><td><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> There are no subscribers</td></tr>";
                        }
                    }
                    else
                    {
                        strSubscribers += "<tr><td><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> Could not find Active Directory Group <b>" + "GSGwra_" + strName + "</b></td></tr>";
                    }
                    txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString();
                    int intContact1 = 0;
                    int intContact2 = 0;
                    if (ds.Tables[0].Rows[0]["contact1"].ToString() != "")
                    {
                        intContact1 = Int32.Parse(ds.Tables[0].Rows[0]["contact1"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["contact2"].ToString() != "")
                    {
                        intContact2 = Int32.Parse(ds.Tables[0].Rows[0]["contact2"].ToString());
                    }
                    if (intContact1 > 0)
                    {
                        txtContact1.Text  = oUser.GetFullName(intContact1) + " (" + oUser.GetName(intContact1) + ")";
                        hdnContact1.Value = intContact1.ToString();
                    }
                    if (intContact2 > 0)
                    {
                        txtContact2.Text  = oUser.GetFullName(intContact2) + " (" + oUser.GetName(intContact2) + ")";
                        hdnContact2.Value = intContact2.ToString();
                    }
                    chkEnabled.Checked        = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    lstCurrent.DataValueField = "id";
                    lstCurrent.DataTextField  = "name";
                    lstCurrent.DataSource     = oWorkstation.GetPoolWorkstations(intID);
                    lstCurrent.DataBind();
                    lstAvailable.DataValueField = "id";
                    lstAvailable.DataTextField  = "name";
                    lstAvailable.DataSource     = oWorkstation.GetPoolWorkstations(intProfile, intID);
                    lstAvailable.DataBind();
                    string strWorkstations = "";
                    int    intCount        = 0;
                    foreach (ListItem oItem in lstCurrent.Items)
                    {
                        strWorkstations = strWorkstations + oItem.Value + "_" + intCount.ToString() + "&";
                        intCount++;
                    }
                    hdnWorkstations.Value = strWorkstations;
                    txtContact1.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divContact1.ClientID + "','" + lstContact1.ClientID + "','" + hdnContact1.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstContact1.Attributes.Add("ondblclick", "AJAXClickRow();");
                    txtContact2.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divContact2.ClientID + "','" + lstContact2.ClientID + "','" + hdnContact2.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstContact2.Attributes.Add("ondblclick", "AJAXClickRow();");
                    btnAdd.Attributes.Add("onclick", "return MoveList('" + lstAvailable.ClientID + "','" + lstCurrent.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    lstAvailable.Attributes.Add("ondblclick", "return MoveList('" + lstAvailable.ClientID + "','" + lstCurrent.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    btnRemove.Attributes.Add("onclick", "return MoveList('" + lstCurrent.ClientID + "','" + lstAvailable.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    lstCurrent.Attributes.Add("ondblclick", "return MoveList('" + lstCurrent.ClientID + "','" + lstAvailable.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a name')" +
                                             " && ValidateText('" + txtDescription.ClientID + "','Please enter a description')" +
                                             " && ValidateHidden0('" + hdnContact1.ClientID + "','" + txtContact1.ClientID + "','Please enter a primary contact')" +
                                             " && ValidateHidden0('" + hdnContact2.ClientID + "','" + txtContact2.ClientID + "','Please enter a secondary contact')" +
                                             ";");
                }
            }
            else if (Request.QueryString["create"] != null)
            {
                panCreate.Visible = true;
                LoadLists();
                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>");
                    }
                }
                int intAddress = intLocation;
                if (intAddress > 0)
                {
                    txtParent.Text = oLocation.GetFull(intAddress);
                }
                hdnParent.Value = intAddress.ToString();
                btnContinue.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" +
                                           " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" +
                                           " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an operating system')" +
                                           " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" +
                                           " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" +
                                           ";");
            }
            else if (Request.QueryString["rid"] != null)
            {
                int intRequest = Int32.Parse(Request.QueryString["rid"]);
                panExecute.Visible = true;
                DataSet dsService = oForecast.GetAnswerService(intRequest);
                if (dsService.Tables[0].Rows.Count > 0)
                {
                    int    intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                    int    intType    = oModelsProperties.GetType(intModelVirtual);
                    string strExecute = oType.Get(intType, "forecast_execution_path");
                    if (strExecute != "")
                    {
                        btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                    }
                    else
                    {
                        btnExecute.Attributes.Add("onclick", "alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;");
                    }
                }
                else
                {
                    btnExecute.Attributes.Add("onclick", "alert('There was a problem executing this request...please contact your ClearView administrator');return false;");
                }
            }
            else
            {
                DataSet ds = oWorkstation.GetPools(0);
                panPools.Visible    = true;
                rptPools.DataSource = ds;
                rptPools.DataBind();
                foreach (RepeaterItem ri in rptPools.Items)
                {
                    Label lblWorkstations = (Label)ri.FindControl("lblWorkstations");
                    lblWorkstations.Text = oWorkstation.GetPoolWorkstations(Int32.Parse(lblWorkstations.Text)).Tables[0].Rows.Count.ToString();
                }
                lblPools.Visible = (rptPools.Items.Count == 0);
            }
        }
예제 #18
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);
                }
            }
        }
        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>");
            }
        }
예제 #20
0
        public string GetBody(int _requestid, int _itemid, int _number, int _serviceid, int _rrid, int _rr_workflowid, string _se_dsn, int _environment, string _dsn_asset, string _dsn_ip)
        {
            string              strView              = "";
            Applications        oApplication         = new Applications(user, dsn);
            RequestItems        oRequestItem         = new RequestItems(user, dsn);
            ResourceRequest     oResourceRequest     = new ResourceRequest(user, dsn);
            Users               oUser                = new Users(user, dsn);
            Services            oService             = new Services(user, dsn);
            Variables           oVariable            = new Variables(_environment);
            Functions           oFunction            = new Functions(0, dsn, _environment);
            Requests            oRequest             = new Requests(user, dsn);
            Projects            oProject             = new Projects(user, dsn);
            ServiceRequests     oServiceRequest      = new ServiceRequests(user, dsn);
            ServiceEditor       oServiceEditor       = new ServiceEditor(user, _se_dsn);
            Servers             oServer              = new Servers(user, dsn);
            Workstations        oWorkstation         = new Workstations(user, dsn);
            AssetOrder          oAssetOrder          = new AssetOrder(user, dsn, _dsn_asset, _environment);
            AssetSharedEnvOrder oAssetSharedEnvOrder = new AssetSharedEnvOrder(user, dsn, _dsn_asset, _environment);
            PNCTasks            oPNCTask             = new PNCTasks(user, dsn);
            TSM          oTSM         = new TSM(user, dsn);
            StatusLevels oStatusLevel = new StatusLevels();

            DataSet dsRR = oResourceRequest.GetRequestService(_requestid, _serviceid, _number);

            if (dsRR.Tables[0].Rows.Count > 0)
            {
                if (_rrid == 0)
                {
                    Int32.TryParse(dsRR.Tables[0].Rows[0]["parent"].ToString(), out _rrid);
                }
                if (_rr_workflowid == 0)
                {
                    Int32.TryParse(dsRR.Tables[0].Rows[0]["id"].ToString(), out _rr_workflowid);
                }
            }

            // Workflow
            string strWorkflowName = "";
            int    intProject      = oRequest.GetProjectNumber(_requestid);

            if (intProject > 0)
            {
                strView += "<tr><td valign=\"top\"><b>Project Name:</b></td>";
                strView += "<td colspan=\"40\">" + oProject.Get(intProject, "name") + "</td></tr>";
                strView += "<tr><td valign=\"top\"><b>Project Number:</b></td>";
                strView += "<td>" + "<a href=\"" + oRequest.GetDataPointLink(_requestid, _environment) + "\" target=\"_blank\">" + oProject.Get(intProject, "number") + "</a></td></tr>";
            }
            else
            {
                string strTaskName = "N/A";
                if (_rr_workflowid > 0)
                {
                    strTaskName = oResourceRequest.GetWorkflow(_rr_workflowid, "name").Trim();
                }
                if ((strTaskName == "" || strTaskName == "N/A") && _rrid > 0)
                {
                    strTaskName = oResourceRequest.Get(_rrid, "name").Trim();
                }
                if ((strTaskName == "" || strTaskName == "N/A") && _requestid > 0)
                {
                    strTaskName = oServiceRequest.Get(_requestid, "name").Trim();
                }
                strView += "<tr><td valign=\"top\"><b>Task Name:</b></td>";
                strView += "<td colspan=\"40\">" + strTaskName + "</td></tr>";
            }
            strView += "<tr><td valign=\"top\"><b>Task Number:</b></td>";
            strView += "<td>" + "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(_rrid.ToString()) + "', '800', '600');\">CVT" + _requestid.ToString() + "-" + _serviceid.ToString() + "-" + _number.ToString() + "</a></td></tr>";
            //strWorkflowName += "<td>" + "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('" + oRequest.GetDataPointLink(_requestid, _environment) + "', '800', '600');\">CVT" + _requestid.ToString() + "</a></td>";

            string strWorkflowRequested  = "";
            string strWorkflowCreated    = "";
            string strWorkflowService    = "";
            string strWorkflowDepartment = "";
            string strWorkflowResources  = "";
            string strWorkflowStatus     = "";
            string strWorkflowComments   = "";
            int    intStatus             = 0;

            // Requested
            strWorkflowRequested += "<td valign=\"top\"><b>Requested By:</b></td>";
            int intRequestor        = oRequest.GetUser(_requestid);
            int intRequestorManager = 0;

            Int32.TryParse(oUser.Get(intRequestor, "manager"), out intRequestorManager);
            Int32.TryParse(oResourceRequest.Get(_rrid, "status"), out intStatus);
            strWorkflowRequested += "<td>" + oUser.GetFullName(intRequestor) + " (" + oUser.GetName(intRequestor) + ")" + "</td>";
            strWorkflowCreated   += "<td valign=\"top\"><b>Created On:</b></td>";
            if (_rrid > 0)
            {
                strWorkflowCreated += "<td>" + DateTime.Parse(oResourceRequest.Get(_rrid, "created")).ToLongDateString() + "</td>";
            }
            else
            {
                strWorkflowCreated += "<td>" + DateTime.Parse(oRequest.Get(_requestid, "created")).ToLongDateString() + "</td>";
            }
            // Service
            strWorkflowService += "<td valign=\"top\"><b>Service:</b></td>";
            if (_serviceid == 0)
            {
                strWorkflowService += "<td>" + oRequestItem.GetItem(_itemid, "service_title") + "</td>";
            }
            else
            {
                strWorkflowService += "<td>" + oService.GetName(_serviceid) + "</td>";
            }
            // Department
            strWorkflowDepartment += "<td valign=\"top\"><b>Department:</b></td>";
            strWorkflowDepartment += "<td>" + oApplication.Get(oRequestItem.GetItemApplication(_itemid), "service_title") + "</td>";
            // Resources
            string  strApprovers = "";
            DataSet dsApprovals  = oResourceRequest.GetApprovals(_requestid, _serviceid, _number);

            foreach (DataRow drApprover in dsApprovals.Tables[0].Rows)
            {
                int intApprover = Int32.Parse(drApprover["userid"].ToString());
                if (drApprover["approved"].ToString() == "" && drApprover["denied"].ToString() == "")
                {
                    if (strApprovers != "")
                    {
                        strApprovers += "\\n";
                    }
                    strApprovers += oUser.GetFullName(intApprover) + " (" + oUser.GetName(intApprover) + ")";
                }
            }
            bool boolAutomated = (oService.Get(_serviceid, "automate") == "1");

            if (boolAutomated == false)
            {
                DataSet dsReqForm = oRequestItem.GetForm(_requestid, _serviceid, _itemid, _number);
                if (dsReqForm.Tables[0].Rows.Count > 0)
                {
                    boolAutomated = (dsReqForm.Tables[0].Rows[0]["automated"].ToString() == "1" ? true : false);
                }
            }
            strWorkflowResources += "<td valign=\"top\"><b>Assigned:</b></td>";
            strWorkflowStatus    += "<td><b>Status:</b></td>";
            if (boolAutomated == true)
            {
                strWorkflowResources += "<td valign=\"top\">---</td>";
                intStatus             = (int)ResourceRequestStatus.NotAvailable; // Set to N/A since it is automated...
                strWorkflowStatus    += "<td>" + oStatusLevel.HTML(intStatus) + "</td>";
            }
            else
            {
                List <WorkflowStatus> RR = oResourceRequest.GetStatus(null, _rrid, null, null, null, null, false, _se_dsn);
                if (RR.Count > 0)
                {
                    StringBuilder strUsers = new StringBuilder();
                    foreach (string strUser in RR[0].users)
                    {
                        if (String.IsNullOrEmpty(strUser) == false)
                        {
                            strUsers.Append(strUser);
                            strUsers.AppendLine("<br/>");
                        }
                    }
                    strWorkflowResources += "<td valign=\"top\">" + strUsers.ToString() + "</td>";
                    strWorkflowStatus    += "<td>" + RR[0].status + "</td>";
                    if (String.IsNullOrEmpty(RR[0].comments) == false)
                    {
                        strWorkflowComments += "<td valign=\"top\"><b>Comments:</b></td>";
                        strWorkflowComments += "<td valign=\"top\">" + oFunction.FormatText(RR[0].comments) + "</td>";
                    }
                }
                else
                {
                    strWorkflowResources += "<td valign=\"top\"> N / A </td>";
                    strWorkflowStatus    += "<td> N / A </td>";
                }
            }
            strView += "<tr>" + strWorkflowRequested + "</tr><tr>" + strWorkflowCreated + "</tr><tr>" + strWorkflowService + "</tr><tr>" + strWorkflowDepartment + "</tr>" + "<tr>" + strWorkflowStatus + "</tr>" + (strWorkflowResources == "" ? "" : "<tr>" + strWorkflowResources + "</tr>") + (strWorkflowComments == "" ? "" : "<tr>" + strWorkflowComments + "</tr>");

            if (strView == "")
            {
                strView = "Information Unavailable";
            }
            else
            {
                strView = "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">" + strView + "</table>";
                StringBuilder      sbViewRequest       = new StringBuilder();
                Customized         oCustomized         = new Customized(user, dsn);
                DNS                oDNS                = new DNS(user, dsn);
                OnDemandTasks      oOnDemandTask       = new OnDemandTasks(user, dsn);
                Reports            oReport             = new Reports(user, dsn);
                Audit              oAudit              = new Audit(user, dsn);
                Enhancements       oEnhancement        = new Enhancements(user, dsn);
                ServerDecommission oServerDecommission = new ServerDecommission(0, dsn);
                Storage            oStorage            = new Storage(0, dsn);

                string strCatch = "1";
                try
                {
                    sbViewRequest.Append(oServiceEditor.GetRequestBody(_requestid, _serviceid, _number, dsn));
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "2";
                        sbViewRequest.Append(oCustomized.GetPNCDNSConflictBody(_requestid, _itemid, _number));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "3";
                        sbViewRequest.Append(oCustomized.GetStorage3rdBody(_requestid, _itemid, _number, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "4";
                        sbViewRequest.Append(oOnDemandTask.GetServerOther(_requestid, _serviceid, _number, _environment, _dsn_asset, _dsn_ip));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "5";
                        sbViewRequest.Append(GetBody(oReport.GetOrderReport(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "6";
                        sbViewRequest.Append(oServerDecommission.GetBody(_requestid, _number, _dsn_asset, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "7";
                        sbViewRequest.Append(oCustomized.GetDecommissionServerBody(_requestid, _itemid, _number, _dsn_asset));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "7.1";
                        sbViewRequest.Append(oWorkstation.GetApprovalSummary(_requestid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "8";
                        int intEnhancementID = oCustomized.GetEnhancementID(_requestid);
                        if (intEnhancementID > 0)
                        {
                            sbViewRequest.Append("<tr><td>");
                            sbViewRequest.Append(oCustomized.GetEnhancementBody(intEnhancementID, _environment, false));
                            sbViewRequest.Append("</td></tr>");
                        }
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "9";
                        int intIssueID = oCustomized.GetIssueID(_requestid);
                        if (intIssueID > 0)
                        {
                            sbViewRequest.Append("<tr><td>");
                            sbViewRequest.Append(oCustomized.GetIssueBody(intIssueID, _environment, false));
                            sbViewRequest.Append("</td></tr>");
                        }
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "10";
                        sbViewRequest.Append(GetBody(oCustomized.GetIIS(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "11";
                        sbViewRequest.Append(GetBody(oCustomized.GetRemediation(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "12";
                        sbViewRequest.Append(GetBody(oCustomized.GetServerArchive(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "13";
                        sbViewRequest.Append(GetBody(oCustomized.GetServerRetrieve(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "14";
                        sbViewRequest.Append(GetBody(oCustomized.GetTPM(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "15";
                        sbViewRequest.Append(GetBody(oCustomized.GetWorkstation(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "16";
                        sbViewRequest.Append(GetBody(oCustomized.GetThirdTierDistributed(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "17";
                        sbViewRequest.Append(GetBody(oCustomized.GetGeneric(_requestid, _itemid, _number), _serviceid));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "18";
                        sbViewRequest.Append(oDNS.GetDNSBody(_requestid, _itemid, _number, false, _environment));
                    }
                    if (sbViewRequest.ToString() == "")
                    {
                        strCatch = "19";
                        sbViewRequest.Append(oAudit.GetErrorBody(_requestid, _serviceid, _number));
                    }

                    if (sbViewRequest.ToString() == "")//Server Error Provisioning Support
                    {
                        strCatch = "20";
                        sbViewRequest.Append(oServer.GetErrorDetailsBody(_requestid, _itemid, _number, _environment));
                    }

                    if (sbViewRequest.ToString() == "") //Workstation Error Provisioning Support
                    {
                        strCatch = "21";
                        sbViewRequest.Append(oWorkstation.GetVirtualErrorDetailsBody(_requestid, _number, _environment));
                    }

                    if (sbViewRequest.ToString() == "") //Asset Procurement
                    {
                        strCatch = "22";
                        sbViewRequest.Append(oAssetOrder.GetOrderBody(_requestid, _itemid, _number));
                    }

                    if (sbViewRequest.ToString() == "") //Shared Environement - IM
                    {
                        strCatch = "23";
                        sbViewRequest.Append(oAssetSharedEnvOrder.GetOrderBody(_requestid, _itemid, _number));
                    }

                    if (sbViewRequest.ToString() == "") //Backup
                    {
                        strCatch = "24";
                        sbViewRequest.Append(oTSM.GetBody(_requestid, _itemid, _number, _dsn_asset, _dsn_ip));
                    }

                    if (sbViewRequest.ToString() == "") // New Enhancement
                    {
                        strCatch = "25";
                        sbViewRequest.Append(oEnhancement.GetBodyRequest(_requestid, _environment));
                    }

                    if (sbViewRequest.ToString() == "") // New Enhancement
                    {
                        strCatch = "26";
                        sbViewRequest.Append(oStorage.GetBody(_requestid, _itemid, _number, _dsn_asset, _dsn_ip, _environment, false));
                    }


                    if (sbViewRequest.ToString() == "")
                    {
                        //strViewRequest = "Information Unavailable";
                        sbViewRequest.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                    }
                    else
                    {
                        if (sbViewRequest.ToString().Trim().StartsWith("<table") == false)
                        {
                            sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\">");
                            sbViewRequest.Append("</table>");
                        }
                    }
                }
                catch
                {
                    sbViewRequest = new StringBuilder("&nbsp;&nbsp;** WARNING: Information Unavailable (# " + strCatch + ") **&nbsp;&nbsp;");
                }
                sbViewRequest.Insert(0, "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\" style=\"" + oVariable.DefaultFontStyle() + "\"><tr><td>");
                sbViewRequest.Append("</td></tr></table>");
                strView += "<br/>" + sbViewRequest.ToString();
            }
            return(strView);
        }
예제 #21
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);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);

            // For server Workstation Errors
            oServer      = new Servers(intProfile, dsn);
            oWorkstation = new Workstations(intProfile, dsn);
            oZeus        = new Zeus(intProfile, dsnZeus);
            oAsset       = new Asset(0, dsnAsset);
            oOnDemand    = new OnDemand(intProfile, dsn);
            oError       = new Errors(intProfile, dsn);
            oVariable    = new Variables(intEnvironment);

            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["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                // Start Workflow Change
                lblResourceWorkflow.Text = Request.QueryString["rrid"];
                int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]);
                int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
                ds = oResourceRequest.Get(intResourceParent);
                // End Workflow Change
                intRequest          = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest));
                lblRequestedOn.Text = DateTime.Parse(oResourceRequest.Get(intResourceParent, "created")).ToString();
                lblDescription.Text = oRequest.Get(intRequest, "description");
                if (lblDescription.Text == "")
                {
                    lblDescription.Text = "<i>No information</i>";
                }
                intItem   = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                // Start Workflow Change
                bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3");
                int  intUser      = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name");
                double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                boolJoined = (oResourceRequest.GetWorkflow(intResourceWorkflow, "joined") == "1");
                // End Workflow Change
                intService      = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                lblService.Text = oService.Get(intService, "name");
                int intApp = oRequestItem.GetItemApplication(intItem);

                if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>");
                }
                if (Request.QueryString["status"] != null && Request.QueryString["status"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Updates has been Added');<" + "/" + "script>");
                }
                if (!IsPostBack)
                {
                    double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                    lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent);
                    if (dblAllocated == dblUsed)
                    {
                        if (boolComplete == false)
                        {
                            oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                            btnComplete.Attributes.Add("onclick", "return confirm('Are you sure you want to mark this as completed and remove it from your workload?');");
                        }
                        else
                        {
                            oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                            btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;");
                        }
                    }
                    else
                    {
                        btnComplete.ImageUrl = "/images/tool_complete_dbl.gif";
                        btnComplete.Enabled  = false;
                    }
                    bool boolSLABreached = false;
                    if (oService.Get(intService, "sla") != "")
                    {
                        oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");
                        int intDays = oResourceRequest.GetSLA(intResourceParent);
                        if (intDays > -99999)
                        {
                            if (intDays < 1)
                            {
                                btnSLA.Style["border"] = "solid 2px #FF0000";
                            }
                            else if (intDays < 3)
                            {
                                btnSLA.Style["border"] = "solid 2px #FF9999";
                            }
                            boolSLABreached = (intDays < 0);
                            btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');");
                        }
                        else
                        {
                            btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                            btnSLA.Enabled  = false;
                        }
                    }
                    else
                    {
                        btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                        btnSLA.Enabled  = false;
                    }
                    oFunction.ConfigureToolButton(btnEmail, "/images/tool_email");
                    btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=GENERIC');");
                    dblUsed = (dblUsed / dblAllocated) * 100;

                    intProject          = oRequest.GetProjectNumber(intRequest);
                    hdnTab.Value        = "D";
                    panWorkload.Visible = true;
                    bool boolRed = LoadStatus(intResourceWorkflow);
                    if (boolRed == false && boolSLABreached == true)
                    {
                        btnComplete.Attributes.Add("onclick", "alert('NOTE: Your Service Level Agreement (SLA) has been breached!\\n\\nYou must provide a RED STATUS update with an explanation of why your SLA was breached for this request.\\n\\nOnce a RED STATUS update has been provided, you will be able to complete this request.');return false;");
                    }

                    LoadLists();
                    LoadInformation(intResourceWorkflow);
                    chkDescription.Checked = (Request.QueryString["doc"] != null);

                    //Change Control and Documents
                    LoadChange(intResourceWorkflow);
                    lblDocuments.Text = oDocument.GetDocuments_Service(intRequest, intService, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null));
                    // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                    //lblDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, 0, intRequest, 0, 1, (Request.QueryString["doc"] != null), false);

                    btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                    oFunction.ConfigureToolButton(btnSave, "/images/tool_save");
                    oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                    btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                    oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                    btnClose.Attributes.Add("onclick", "return ExitWindow();");
                    btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "');");
                    btnChange.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter a change control number')" +
                                             " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid implementation date')" +
                                             " && ValidateTime('" + txtTime.ClientID + "','Please enter a valid implementation time')" +
                                             ";");
                    imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
                    // 6/1/2009 - Load ReadOnly View
                    if ((oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false) || boolComplete == true)
                    {
                        oFunction.ConfigureToolButtonRO(btnSave, btnComplete);
                        pnlSolutions.Visible   = false;
                        btnNoSolution.Enabled  = false;
                        btnNewSolution.Enabled = false;
                    }


                    btnReturn.Visible   = false;
                    btnComplete.Visible = false;
                }
            }
            else
            {
                panDenied.Visible = true;
            }
            txtIncidentUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divIncidentUser.ClientID + "','" + lstIncidentUser.ClientID + "','" + hdnIncidentUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstIncidentUser.Attributes.Add("ondblclick", "AJAXClickRow();");
        }
예제 #23
0
 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','');");
 }
예제 #24
0
        protected void btnApprove_Click(Object Sender, EventArgs e)
        {
            if (Request.QueryString["rrid"] != null)
            {
                // Approved; Send to team lead for assignment
                int    intResource = Int32.Parse(Request.QueryString["rrid"]);
                int    intRequest  = Int32.Parse(oResourceRequest.Get(intResource, "requestid"));
                int    intService  = Int32.Parse(oResourceRequest.Get(intResource, "serviceid"));
                int    intNumber   = Int32.Parse(oResourceRequest.Get(intResource, "number"));
                string strCVT      = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();

                int     ApprovalID = 0;
                DataSet dsApproval = oResourceRequest.GetApprovals(intRequest, intService, intNumber);
                foreach (DataRow drApproval in dsApproval.Tables[0].Rows)
                {
                    if (Int32.Parse(drApproval["userid"].ToString()) == intProfile)
                    {
                        if (String.IsNullOrEmpty(drApproval["approved"].ToString()) == false ||
                            String.IsNullOrEmpty(drApproval["denied"].ToString()) == false)
                        {
                            ApprovalID = Int32.Parse(drApproval["id"].ToString());
                            break;
                        }
                    }
                }

                if (ApprovalID == 0)
                {
                    oLog.AddEvent(intRequest.ToString(), strCVT, "Not already approved for user " + oUser.GetName(intProfile), LoggingType.Debug);
                    oResourceRequest.UpdateStatusOverall(intResource, 2);
                    if (oResourceRequest.Get(intResource, "platform_approval") == "0")
                    {
                        // Platform Approve
                        oResourceRequest.ApprovePlatform(intResource, 1);
                        SendEmail(intRequest, true, "PLATFORM", txtReason.Text);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved PLATFORM", LoggingType.Debug);
                    }
                    else if (oService.GetSelected(intRequest, intService, intNumber, "approved") == "0")
                    {
                        // Service Manager Approve
                        oService.UpdateSelectedApprove(intRequest, intService, intNumber, 1, intProfile, DateTime.Now, "");
                        SendEmail(intRequest, true, "SERVICE MANAGER", txtReason.Text);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved SERVICE MANAGER", LoggingType.Debug);
                    }
                    else
                    {
                        oResourceRequest.UpdateApproval(intRequest, intService, intNumber, intProfile, txtReason.Text, DateTime.Now.ToString(), "");
                        SendEmail(intRequest, true, "3RD PARTY APPROVER", txtReason.Text);
                        oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved 3RD PARTY APPROVER", LoggingType.Debug);
                    }
                    int intItem = Int32.Parse(oResourceRequest.Get(intResource, "itemid"));
                    if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                    {
                        oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                    }
                }
                else
                {
                    oLog.AddEvent(intRequest.ToString(), strCVT, "Already approved for user " + oUser.GetName(intProfile), LoggingType.Debug);
                }
            }
            if (Request.QueryString["srid"] != null)
            {
                // Approved; Permit submission
                int     intServiceSelectedID = Int32.Parse(Request.QueryString["srid"]);
                DataSet dsServiceSelected    = oService.GetSelectedById(intServiceSelectedID);
                DataRow drServiceSelected    = dsServiceSelected.Tables[0].Rows[0];
                int     intRequest           = Int32.Parse(drServiceSelected["requestid"].ToString());
                int     intService           = Int32.Parse(drServiceSelected["serviceid"].ToString());
                int     intItem   = oService.GetItemId(intService);
                int     intNumber = Int32.Parse(drServiceSelected["number"].ToString());
                string  strCVT    = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                oService.UpdateSelectedApprove(intRequest, intService, intNumber, 1, intProfile, DateTime.Now, "");
                SendEmail(intRequest, true, "SERVICE MANAGER", txtReason.Text);
                oLog.AddEvent(intRequest.ToString(), strCVT, "User " + oUser.GetName(intProfile) + " approved SERVICE MANAGER", LoggingType.Debug);

                // Kick off any automated processing...
                Workstations oWorkstation = new Workstations(intProfile, dsn);
                oWorkstation.ExecuteVMware(intRequest);
            }
            if (Request.QueryString["rid"] != null)
            {
                // Manager Approve
                int intRequest = Int32.Parse(Request.QueryString["rid"]);
                oServiceRequest.UpdateApproval(intRequest, 1);
                oResourceRequest.UpdateStatusRequest(intRequest, 2);
                SendEmail(intRequest, true, "MANAGER", txtReason.Text);
                DataSet dsForm = oRequestItem.GetForms(intRequest);
                foreach (DataRow drForm in dsForm.Tables[0].Rows)
                {
                    int intService = 0;
                    Int32.TryParse(drForm["serviceid"].ToString(), out intService);
                    int intNumber = 0;
                    Int32.TryParse(drForm["number"].ToString(), out intNumber);
                    if (intService > 0 && intNumber > 0)
                    {
                        if (oServiceRequest.NotifyApproval(intRequest, intService, intNumber, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                        {
                            // Send to Team Lead for assignment
                            ds = oResourceRequest.GetUnAssigned(intRequest, 0);
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                int intItem = Int32.Parse(dr["itemid"].ToString());
                                oServiceRequest.NotifyTeamLead(intItem, Int32.Parse(dr["id"].ToString()), intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                            }
                        }
                    }
                }
            }
            Response.Redirect(oPage.GetFullLink(intPage) + "?action=finish");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile      = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset          = new Asset(intProfile, dsnAsset);
            oForecast       = new Forecast(intProfile, dsn);
            oWorkstation    = new Workstations(intProfile, dsn);
            oServiceRequest = new ServiceRequests(intProfile, dsn);
            oOnDemandTasks  = new OnDemandTasks(intProfile, dsn);

            //Menu
            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);

            //End Menu



            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);
            }
            int intForecast = 0;

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID       = Int32.Parse(Request.QueryString["id"]);
                intForecast = Int32.Parse(oForecast.GetAnswer(intID, "forecastid"));
                intRequest  = oForecast.GetRequestID(intID, true);
                DataSet dsRequest = oServiceRequest.Get(intRequest);
                if (dsRequest.Tables[0].Rows.Count > 0)
                {
                    Response.Redirect(Request.Path + "?rid=" + intRequest);
                }
            }
            if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
            }
            if (Request.QueryString["notify"] != null)
            {
                string strRedirect = Request.Url.PathAndQuery;
                strRedirect = strRedirect.Substring(0, strRedirect.IndexOf("&notify"));
                if (Request.QueryString["notify"] == "true")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has been successfully notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "false")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has ALREADY been notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('There was a problem notifying your design implementor\\n\\nPlease contact your ClearView administrator\\n\\nRequestID: " + intRequest.ToString() + "');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
            }
            if (intID > 0)
            {
                panBegin.Visible = true;
                bool boolAssigned = false;
                if (oForecast.CanAutoProvision(intID) == true)
                {
                    boolAssigned = true;
                }
                else if (oOnDemandTasks.GetPending(intID).Tables[0].Rows.Count > 0)
                {
                    boolAssigned = true;
                }

                if (intForecast == 0)
                {
                    btnStart.Attributes.Add("onclick", "return ProcessButton(this);");
                }
                else if (boolAssigned == false)
                {
                    btnStart.Attributes.Add("onclick", "alert('You cannot execute a design until a design implementor has been assigned.');return false;");
                }
                else
                {
                    lblNotify.Visible = true;
                    //btnStart.Attributes.Add("onclick", "return confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?') && OpenWindow('AUTO_PROVISIONING','?answerid=" + intID.ToString() + "&modelid=" + oForecast.GetModel(intID).ToString() + "');");
                    btnStart.Attributes.Add("onclick", "return confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?');");
                }
            }
            else if (intRequest > 0)
            {
                intRequest       = Int32.Parse(Request.QueryString["rid"]);
                panStart.Visible = true;
                DataSet   ds        = oWorkstation.GetVirtualRequests(intRequest);
                int       intCount  = 0;
                Functions oFunction = new Functions(intProfile, dsn, intEnvironment);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    intCount++;
                    int    intDevice = Int32.Parse(dr["id"].ToString());
                    int    intAsset  = Int32.Parse(dr["assetid"].ToString());
                    string strName   = "Device " + intCount.ToString();
                    if (intAsset > 0)
                    {
                        string strTempName = oAsset.Get(intAsset, "name");
                        if (strTempName != "")
                        {
                            strName = strTempName;
                        }
                    }
                    if (intCount == 1)
                    {
                        //strTab += "<td><img src=\"/images/TabOnLeftCap.gif\"></td><td nowrap background=\"/images/TabOnBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOnRightCap.gif\"></td>";
                        oTab.AddTab(strName, "");
                        strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:inline\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"/ondemand/ondemand_workstation_virtual.aspx?id=" + oFunction.encryptQueryString(intDevice.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                    }
                    else
                    {
                        // strTab += "<td><img src=\"/images/TabOffLeftCap.gif\"></td><td nowrap background=\"/images/TabOffBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOffRightCap.gif\"></td>";
                        oTab.AddTab(strName, "");
                        strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:none\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"/ondemand/ondemand_workstation_virtual.aspx?id=" + oFunction.encryptQueryString(intDevice.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                    }
                }
                //if (strTab != "")
                //    strMenuTab1 += "<tr>" + strTab + "<td width=\"100%\" background=\"/images/TabEmptyBackground.gif\">&nbsp;</td></tr>";
                //strMenuTab1 = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" + strMenuTab1 + "</table>";
                strMenuTab1 = oTab.GetTabs();
            }
        }
예제 #26
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','');");
        }
예제 #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oOnDemand         = new OnDemand(intProfile, dsn);
     oForecast         = new Forecast(intProfile, dsn);
     oModel            = new Models(intProfile, dsn);
     oModelsProperties = new ModelsProperties(intProfile, dsn);
     oWorkstation      = new Workstations(intProfile, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
     }
     if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
     {
         intStep = Int32.Parse(Request.QueryString["sid"]);
     }
     if (Request.QueryString["step"] != null && Request.QueryString["step"] != "")
     {
         panUpdate.Visible = true;
     }
     else
     {
         panNavigation.Visible = true;
     }
     if (intID > 0)
     {
         DataSet ds = oForecast.GetAnswer(intID);
         if (ds.Tables[0].Rows.Count > 0)
         {
             intRequest    = oForecast.GetRequestID(intID, true);
             intTotalCount = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
             intTotalDR    = Int32.Parse(ds.Tables[0].Rows[0]["recovery_number"].ToString());
             int intModel = oForecast.GetModel(intID);
             intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
             intType  = oModel.GetType(intModel);
             DataSet dsSteps  = oOnDemand.GetWizardSteps(intType, 1);
             int     intCount = Int32.Parse(oOnDemand.GetWizardStep(intStep, "step"));
             if (dsSteps.Tables[0].Rows.Count == intCount)
             {
                 btnNext.Text = "Finish";
             }
             if (intCount == 0 || intCount == 1)
             {
                 btnBack.Enabled = false;
             }
             if (!IsPostBack)
             {
                 LoadDevices(intModel);
             }
             if (boolConfigured == true)
             {
                 panValid.Visible = true;
             }
             //                else
             //                    panInvalid.Visible = true;
         }
     }
     btnClose.Attributes.Add("onclick", "return window.close();");
     btnNext.Attributes.Add("onclick", "return ValidateBoolean(" + (boolConfigured ? "true" : "false") + ",'You cannot continue until you have configured all devices.\\n\\nClick OK to close this window. Then click [Edit] to configure each device.');");
     btnUpdate.Attributes.Add("onclick", "return ValidateBoolean(" + (boolConfigured ? "true" : "false") + ",'You cannot continue until you have configured all devices.\\n\\nClick OK to close this window. Then click [Edit] to configure each device.');");
 }
예제 #28
0
파일: Service.cs 프로젝트: radtek/ClearView
        private void ServiceTick()
        {
            try
            {
                // Cleanup ZEUS table
                Zeus oZeus = new Zeus(0, dsnZeus);
                oZeus.DeleteResults();
                AD        oAD       = new AD(0, dsn, intEnvironment);
                Functions oFunction = new Functions(0, dsn, intEnvironment);
                Variables oVariable = new Variables(intEnvironment);
                Log       oLog      = new Log(0, dsn);
                // Check Servers for Zeus
                Servers    oServer     = new Servers(0, dsn);
                ServerName oServerName = new ServerName(0, dsn);
                DataSet    ds          = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_servers WHERE dhcp = '0' AND deleted = 0 OR dhcp = 'SUCCESS' AND deleted = 0");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    int     intServer = Int32.Parse(dr["id"].ToString());
                    DataSet dsZeus    = SqlHelper.ExecuteDataset(dsnZeus, CommandType.Text, "SELECT * FROM cv_zeus_builds WHERE serverid = " + intServer.ToString() + " AND dhcp IS NOT NULL AND deleted = 0");
                    if (dsZeus.Tables[0].Rows.Count > 0)
                    {
                        DataRow drZeus = dsZeus.Tables[0].Rows[0];
                        oLog.AddEvent(drZeus["name"].ToString(), drZeus["serial"].ToString(), "The DHCP address " + drZeus["dhcp"].ToString() + " was found in the BUILD table", LoggingType.Information);
                        SqlHelper.ExecuteNonQuery(dsn, CommandType.Text, "UPDATE cv_servers SET dhcp = '" + drZeus["dhcp"].ToString() + "', modified = getdate() WHERE id = " + intServer.ToString());
                        object o = SqlHelper.ExecuteScalar(dsn, CommandType.Text, "SELECT dhcp FROM cv_servers WHERE id = " + intServer.ToString());
                        if (o != null && o.ToString() != "" && o.ToString() != "0" && o.ToString() != "SUCCESS")
                        {
                            SqlHelper.ExecuteNonQuery(dsnZeus, CommandType.Text, "UPDATE cv_zeus_builds SET deleted = 1, modified = getdate() WHERE id = " + drZeus["id"].ToString());
                            SqlHelper.ExecuteNonQuery(dsnZeus, CommandType.Text, "UPDATE cv_zeus_builds SET deleted = 10, modified = getdate() WHERE deleted = 0 AND serial = '" + drZeus["serial"].ToString() + "'");
                            oLog.AddEvent(drZeus["name"].ToString(), drZeus["serial"].ToString(), "The DHCP address was updated and the BUILD record was deleted", LoggingType.Information);
                        }
                        // Check for Errors
                        DataSet dsError = oServer.GetErrors(intServer);
                        foreach (DataRow drError in dsError.Tables[0].Rows)
                        {
                            if (drError["fixed"].ToString() == "")
                            {
                                oServer.UpdateError(intServer, Int32.Parse(drError["step"].ToString()), 0, 0, true, "");
                                oLog.AddEvent(drZeus["name"].ToString(), drZeus["serial"].ToString(), "The error has been cleared and the build is now ready to continue", LoggingType.Information);
                            }
                        }
                    }
                }
                // Check VMware workstations for Zeus
                Workstations oWorkstation = new Workstations(0, dsn);
                ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_workstation_virtual WHERE dhcp = '0' AND vmware = 1 AND deleted = 0 OR dhcp = 'SUCCESS' AND vmware = 1 AND deleted = 0");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    int     intWorkstation = Int32.Parse(dr["id"].ToString());
                    DataSet dsZeus         = SqlHelper.ExecuteDataset(dsnZeus, CommandType.Text, "SELECT * FROM cv_zeus_builds WHERE vmware_workstationid = " + intWorkstation.ToString() + " AND dhcp IS NOT NULL AND deleted = 0");
                    if (dsZeus.Tables[0].Rows.Count > 0)
                    {
                        DataRow drZeus = dsZeus.Tables[0].Rows[0];
                        oLog.AddEvent(drZeus["name"].ToString(), drZeus["serial"].ToString(), "The DHCP address " + drZeus["dhcp"].ToString() + " was found in the BUILD table", LoggingType.Information);
                        SqlHelper.ExecuteNonQuery(dsn, CommandType.Text, "UPDATE cv_workstation_virtual SET dhcp = '" + drZeus["dhcp"].ToString() + "', modified = getdate() WHERE id = " + intWorkstation.ToString());
                        object o = SqlHelper.ExecuteScalar(dsn, CommandType.Text, "SELECT dhcp FROM cv_workstation_virtual WHERE id = " + intWorkstation.ToString());
                        if (o != null && o.ToString() != "" && o.ToString() != "0" && o.ToString() != "SUCCESS")
                        {
                            SqlHelper.ExecuteNonQuery(dsnZeus, CommandType.Text, "UPDATE cv_zeus_builds SET deleted = 1, modified = getdate() WHERE id = " + drZeus["id"].ToString());
                            oLog.AddEvent(drZeus["name"].ToString(), drZeus["serial"].ToString(), "The DHCP address was updated and the BUILD record was deleted", LoggingType.Information);
                        }
                        // Check for Errors
                        DataSet dsError = oWorkstation.GetVirtualErrors(intWorkstation);
                        foreach (DataRow drError in dsError.Tables[0].Rows)
                        {
                            if (drError["fixed"].ToString() == "")
                            {
                                oWorkstation.UpdateVirtualError(intWorkstation, Int32.Parse(drError["step"].ToString()), 0, 0);
                                oLog.AddEvent(drZeus["name"].ToString(), drZeus["serial"].ToString(), "The error has been cleared and the build is now ready to continue", LoggingType.Information);
                            }
                        }
                    }
                }

                /*
                 * // Check Virtual Workstations for Zeus
                 * Workstations oWorkstation = new Workstations(0, dsn);
                 * Forecast oForecast = new Forecast(0, dsn);
                 * Classes oClass = new Classes(0, dsn);
                 * Workstations oRemote = new Workstations(0, dsnRemote);
                 * ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_workstation_virtual WHERE dhcp = '0' AND vmware = 0 AND deleted = 0 OR dhcp = 'SUCCESS' AND vmware = 0 AND deleted = 0");
                 * foreach (DataRow dr in ds.Tables[0].Rows)
                 * {
                 *  int intWorkstation = Int32.Parse(dr["id"].ToString());
                 *  int intRemote = Int32.Parse(dr["remoteid"].ToString());
                 *  DataSet dsZeus = SqlHelper.ExecuteDataset(dsnZeus, CommandType.Text, "SELECT * FROM cv_zeus_builds WHERE workstationid = " + intWorkstation.ToString() + " AND dhcp IS NOT NULL AND deleted = 0");
                 *  if (dsZeus.Tables[0].Rows.Count > 0)
                 *  {
                 *      SqlHelper.ExecuteNonQuery(dsn, CommandType.Text, "UPDATE cv_workstation_virtual SET dhcp = '" + dsZeus.Tables[0].Rows[0]["dhcp"].ToString() + "', modified = getdate() WHERE id = " + intWorkstation.ToString());
                 *      oRemote.NextRemoteVirtual(intRemote);
                 *      object o = SqlHelper.ExecuteScalar(dsn, CommandType.Text, "SELECT dhcp FROM cv_workstation_virtual WHERE id = " + intWorkstation.ToString());
                 *      if (o != null && o.ToString() != "" && o.ToString() != "0" && o.ToString() != "SUCCESS")
                 *          SqlHelper.ExecuteNonQuery(dsnZeus, CommandType.Text, "UPDATE cv_zeus_builds SET deleted = 1, modified = getdate() WHERE id = " + dsZeus.Tables[0].Rows[0]["id"].ToString());
                 *  }
                 *  else if (dr["dhcp"].ToString() == "0")
                 *  {
                 *      DateTime datModified = DateTime.Parse(dr["modified"].ToString());
                 *      DateTime _now = DateTime.Now;
                 *      TimeSpan oSpan = _now.Subtract(datModified);
                 *      if (oSpan.Hours > 6)
                 *      {
                 *          string strWorkstation = oWorkstation.GetName(Int32.Parse(dr["nameid"].ToString()));
                 *          Ping oPing = new Ping();
                 *          string strStatus = "";
                 *          try
                 *          {
                 *              PingReply oReply = oPing.Send(strWorkstation);
                 *              strStatus = oReply.Status.ToString().ToUpper();
                 *              if (strStatus == "SUCCESS")
                 *                  strStatus = Convert.ToString(oReply.Address);
                 *              else
                 *                  strStatus = "";
                 *          }
                 *          catch { }
                 *          if (strStatus != "")
                 *          {
                 *              if (intLogging > 0)
                 *                  oLog.WriteEntry(String.Format("PING SUCCESS: " + strWorkstation), EventLogEntryType.Information);
                 *              dsZeus = SqlHelper.ExecuteDataset(dsnZeus, CommandType.Text, "SELECT * FROM cv_zeus_builds WHERE name = '" + strWorkstation + "' AND dhcp IS NULL AND deleted = 0");
                 *              if (dsZeus.Tables[0].Rows.Count > 0)
                 *                  SqlHelper.ExecuteNonQuery(dsnZeus, CommandType.Text, "UPDATE cv_zeus_builds SET dhcp = '" + strStatus + "', modified = getdate() WHERE id = " + dsZeus.Tables[0].Rows[0]["id"].ToString());
                 *          }
                 *          else if (intLogging > 0)
                 *              oLog.WriteEntry(String.Format("PING UNSUCCESSFUL: " + strWorkstation), EventLogEntryType.Warning);
                 *      }
                 *  }
                 * }
                 * // Sync Workstations
                 * ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_workstation_virtual WHERE deleted = 0 AND vmware = 0 AND completed IS NULL");
                 * foreach (DataRow dr in ds.Tables[0].Rows)
                 * {
                 *  int intWorkstation = Int32.Parse(dr["id"].ToString());
                 *  int intRemote = Int32.Parse(dr["remoteid"].ToString());
                 *  object o = SqlHelper.ExecuteScalar(dsnRemote, CommandType.Text, "SELECT step FROM cv_virtual_workstations WHERE id = " + intRemote.ToString());
                 *  if (o != null && o.ToString() != "")
                 *      SqlHelper.ExecuteDataset(dsn, CommandType.Text, "UPDATE cv_workstation_virtual SET step = " + o.ToString() + " WHERE id = " + intWorkstation.ToString());
                 * }
                 * // Check Workstations for Installed Applications
                 * ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_workstation_virtual WHERE step = " + intWorkstationInstallStep.ToString() + " AND vmware = 0 AND deleted = 0");
                 * foreach (DataRow dr in ds.Tables[0].Rows)
                 * {
                 *  int intWorkstation = Int32.Parse(dr["id"].ToString());
                 *  int intRemote = Int32.Parse(dr["remoteid"].ToString());
                 *  string strName = oWorkstation.GetName(Int32.Parse(dr["nameid"].ToString()));
                 *  OnDemand oOnDemand = new OnDemand(0, dsn);
                 *  DataSet dsComponents = oWorkstation.GetComponentsSelected(intWorkstation);
                 *  if (dsComponents.Tables[0].Rows.Count == 0)
                 *      oOnDemand.UpdateStepDoneWorkstation(intWorkstation, intWorkstationInstallStep, "No components to install", 0, false, false);
                 *  else
                 *  {
                 *      foreach (DataRow drComponent in dsComponents.Tables[0].Rows)
                 *      {
                 *          int intComponent = Int32.Parse(drComponent["componentid"].ToString());
                 *          if (drComponent["user_group"].ToString() != "")
                 *          {
                 *              oAD.JoinGroup(strName, drComponent["user_group"].ToString());
                 *              strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DEVELOPER_ALERT");
                 *              oFunction.SendEmail("Virtual Workstation Component Installation", drComponent["notifications"].ToString(), "", strEMailIdsBCC, "Virtual Workstation Component Installation", "<p><b>This message is to inform you that the following component(s) were configured for workstation " + strName + "</b></p><p> - " + drComponent["name"].ToString() + "</p>", true, false);
                 *              oOnDemand.UpdateStepDoneWorkstation(intWorkstation, intWorkstationInstallStep, "Successfully installed " + drComponent["name"].ToString() + "<br/>", 0, true, false);
                 *          }
                 *          else
                 *              oOnDemand.UpdateStepDoneWorkstation(intWorkstation, intWorkstationInstallStep, "Unable to install " + drComponent["name"].ToString() + " (currently only configured for user group installations)<br/>", 0, true, false);
                 *          oWorkstation.UpdateComponents(intWorkstation, intComponent, 2);
                 *      }
                 *  }
                 *  oRemote.NextRemoteVirtual(intRemote);
                 * }
                 * if (intProd == 1)
                 * {
                 *  // Check Workstations for completion
                 *  Users oUser = new Users(0, dsn);
                 *  ds = SqlHelper.ExecuteDataset(dsnRemote, CommandType.Text, "SELECT * FROM cv_virtual_workstations WHERE completed IS NOT NULL AND deleted = 0");
                 *  foreach (DataRow dr in ds.Tables[0].Rows)
                 *  {
                 *      int intAnswer = Int32.Parse(dr["answerid"].ToString());
                 *      string strName = dr["name"].ToString();
                 *      string strHost = dr["hostname"].ToString();
                 *      string strEmail = "";
                 *      string strCC = "";
                 *      DataSet dsNotify = SqlHelper.ExecuteDataset(dsnRemote, CommandType.Text, "SELECT * FROM cv_virtual_workstations_notify WHERE name = '" + strName + "'");
                 *      foreach (DataRow drNotify in dsNotify.Tables[0].Rows)
                 *          strEmail += drNotify["xid"].ToString() + ";";
                 *      string strAccounts = "";
                 *      DataSet dsUsers = SqlHelper.ExecuteDataset(dsnRemote, CommandType.Text, "SELECT * FROM cv_virtual_workstations_accounts WHERE name = '" + strName + "'");
                 *      foreach (DataRow drUser in dsUsers.Tables[0].Rows)
                 *      {
                 *          if (drUser["admin"].ToString() == "1")
                 *              strAccounts += oUser.GetFullName(drUser["xid"].ToString()) + " (Administrator)<br/>";
                 *          else if (drUser["remote"].ToString() == "1")
                 *              strAccounts += oUser.GetFullName(drUser["xid"].ToString()) + " (Remote Access)<br/>";
                 *      }
                 *      int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
                 *      if (oClass.IsProd(intClass))
                 *          strCC = oVariable.NotifyWorkstationProd();
                 *      if (intLogging > 0)
                 *          oLog.WriteEntry(String.Format("Attempting to send email for " + strName), EventLogEntryType.Information);
                 *      if (strAccounts == "")
                 *          strAccounts = "Accounts were not requested at this time. To obtain access to this workstation, please fill out a LAN Access Form";
                 *      string strKnowledge = "http://knova.ntl-city.com/selfservice/documentLink.do?externalID=KN10319";
                 *      if (strKnowledge != "")
                 *      {
                 *          strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_ALERT,EMAILGRP_WORKSTATION");
                 *          oFunction.SendEmail("Virtual Workstation Notification: " + strName, strEmail, strCC, strEMailIdsBCC, "Virtual Workstation Notification: " + strName, "<p><b>This message is to inform you that the workstation " + strName + " has been auto-provisioned successfully!</b><p><p>This workstation was created on host <b>" + strHost + "</b>.</p><p>As requested, the following users have been granted rights to this workstation:<br/>" + strAccounts + "</p><p>If you are having problems connecting to your virtual workstation, <a href=\"" + strKnowledge + "\" target=\"_blank\"/>please click here</a> to view a helpful knowledge base article published by the support team.</p><p><b>NOTE:</b> This is automated email sent from the ClearView Auto-Provisioning tool. Please do not respond to this message.</p><p>If you would like to learn more about this process, <a href=\"" + oVariable.URL() + "/info.htm\" target=\"_blank\"/>please click here</a>.</p>", true, false);
                 *      }
                 *      else
                 *      {
                 *          strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_PROVISIONING_ALERT");
                 *          oFunction.SendEmail("Virtual Workstation Notification: " + strName, strEmail, strCC, strEMailIdsBCC, "Virtual Workstation Notification: " + strName, "<p><b>This message is to inform you that the workstation " + strName + " has been auto-provisioned successfully!</b><p><p>This workstation was created on host <b>" + strHost + "</b>.</p><p>As requested, the following users have been granted rights to this workstation:<br/>" + strAccounts + "</p><p><b>NOTE:</b> This is automated email sent from the ClearView Auto-Provisioning tool. Please do not respond to this message.</p><p>If you would like to learn more about this process, <a href=\"" + oVariable.URL() + "/info.htm\" target=\"_blank\"/>please click here</a>.</p>", true, false);
                 *      }
                 *      if (intLogging > 0)
                 *          oLog.WriteEntry(String.Format("Deleting remote workstation ID " + dr["id"].ToString()), EventLogEntryType.Information);
                 *      SqlHelper.ExecuteNonQuery(dsnRemote, CommandType.Text, "UPDATE cv_virtual_workstations SET deleted = 1 WHERE id = " + dr["id"].ToString() + " AND deleted = 0");
                 *  }
                 * }
                 */
            }
            catch (Exception ex)
            {
                string strError = "Zeus Service: " + "(Error Message: " + ex.Message + ") ~ (Source: " + ex.Source + ") (Stack Trace: " + ex.StackTrace + ") [" + System.Environment.UserName + "]";
                oLog.WriteEntry(strError, EventLogEntryType.Error);
                SystemError(strError);
                oLog.WriteEntry(String.Format(ex.Message), EventLogEntryType.Error);
            }
        }
예제 #29
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();");
            }
        }
        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);
                    }
                }
            }
        }