Example #1
0
        private void LoadObjects()
        {
            string strGroup = oFunction.decryptQueryString(Request.QueryString["g"]);

            txtFrom.Text = strGroup;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD oAD = new AD(intProfile, dsn, intDomain);

            lblGroup.Text = oAD.GetUserFullName(strGroup);
            DirectoryEntry oEntry    = oAD.UserSearch(strGroup);
            Variables      oVariable = new Variables(intDomain);

            if (oEntry != null)
            {
                txtTo.Text          = oEntry.Properties["name"].Value.ToString();
                panContinue.Visible = true;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The group could not be found.\\n\\nPlease enter a valid group name to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
        }
Example #2
0
        private void LoadObjects()
        {
            string strGroup = oFunction.decryptQueryString(Request.QueryString["g"]);

            txtGroup.Text = strGroup;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD oAD = new AD(intProfile, dsn, intDomain);

            lblGroup.Text = oAD.GetGroupName(strGroup);
            DirectoryEntry oEntry = oAD.GroupSearch(strGroup);

            if (oEntry != null)
            {
                panTree.Visible = true;
                // Get Group Type
                if (oEntry.Properties.Contains("groupType") == true)
                {
                    switch (oEntry.Properties["groupType"].Value.ToString())
                    {
                    case "-2147483646":
                        radS.Checked  = true;
                        radGG.Checked = true;
                        break;

                    case "-2147483644":
                        radS.Checked   = true;
                        radDLG.Checked = true;
                        break;

                    case "-2147483640":
                        radS.Checked  = true;
                        radUG.Checked = true;
                        break;

                    case "2":
                        radD.Checked  = true;
                        radGG.Checked = true;
                        break;

                    case "4":
                        radD.Checked   = true;
                        radDLG.Checked = true;
                        break;

                    case "8":
                        radD.Checked  = true;
                        radUG.Checked = true;
                        break;
                    }
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The group could not be found.\\n\\nPlease enter a valid group name to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
        }
        protected void btnNext_Click(Object Sender, EventArgs e)
        {
            int intRequest = Int32.Parse(Request.QueryString["rid"]);
            int intItem    = Int32.Parse(lblItem.Text);
            int intNumber  = Int32.Parse(lblNumber.Text);
            int intDomain  = Int32.Parse(ddlDomain.SelectedItem.Value);

            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD             oAD    = new AD(intProfile, dsn, intDomain);
            DirectoryEntry oEntry = oAD.UserSearch(txtUser.Text);

            if (oEntry == null)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString() + "&invalid=true");
            }
            else
            {
                Encryption oEncrypt = new Encryption();
                oAccountRequest.AddMaintenance(intRequest, intItem, intNumber, "PASSWORD", txtUser.Text, Int32.Parse(ddlDomain.SelectedItem.Value));
                oAccountRequest.DeleteMaintenanceParameters(intRequest, intItem, intNumber);
                oAccountRequest.AddMaintenanceParameter(intRequest, intItem, intNumber, oEncrypt.Encrypt(txtPassword1.Text, "adpass"));
                oRequest.UpdateUnNamedRequest(intRequest, "Account Maintenance");
                oRequestItem.UpdateForm(intRequest, true);
                Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString());
            }
        }
 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();
     }
     oDomain      = new Domains(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intDomain = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         LoadClasses();
         if (intDomain > 0)
         {
             lblName.Text = oDomain.Get(intDomain, "name");
         }
     }
 }
Example #5
0
        private void LoadObjects()
        {
            string strUser = oFunction.decryptQueryString(Request.QueryString["u"]);

            txtFrom.Text = strUser;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD oAD = new AD(intProfile, dsn, intDomain);

            lblUser.Text = oAD.GetUserFullName(strUser);
            DirectoryEntry oEntry    = oAD.UserSearch(strUser);
            Variables      oVariable = new Variables(intDomain);

            if (oEntry != null)
            {
                if (oEntry.Properties.Contains("memberof") == true)
                {
                    foreach (string strGroup in oEntry.Properties["memberof"])
                    {
                        DirectoryEntry oEntry2 = new DirectoryEntry("LDAP://" + oVariable.primaryDCName(dsn) + "/" + strGroup, oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword());
                        ListItem       oList   = new ListItem(oEntry2.Properties["name"].Value.ToString());
                        chkGroups.Items.Add(oList);
                        oList.Selected = true;
                    }
                }
                panContinue.Visible = true;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The user account could not be found.\\n\\nPlease enter a valid account to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
        }
Example #6
0
        private void LoadObjects()
        {
            string strUser = oFunction.decryptQueryString(Request.QueryString["u"]);

            txtUser.Text = strUser;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD oAD = new AD(intProfile, dsn, intDomain);

            lblUser.Text = oAD.GetUserFullName(strUser);
            DirectoryEntry oEntry = oAD.UserSearch(strUser);

            if (oEntry != null)
            {
                panTree.Visible = true;
                lblOld.Text     = oEntry.Parent.Properties["distinguishedname"].Value.ToString();
                LoadTree(intDomain);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The user account could not be found.\\n\\nPlease enter a valid account to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
        }
Example #7
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();
        }
Example #8
0
        private void LoadObjects()
        {
            string strUser = oFunction.decryptQueryString(Request.QueryString["u"]);

            txtID.Text = strUser;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            AD             oADSearch = new AD(intProfile, dsn, intEnvironment);
            DirectoryEntry oProd     = oADSearch.UserSearch(strUser);

            if (oProd == null)
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "bad", "<script type=\"text/javascript\">alert('Invalid LAN ID.\\n\\nPlease enter a valid LAN ID to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
            else
            {
                strUser    = "******" + strUser.Substring(1).ToUpper();
                lblID.Text = strUser;
                intDomain  = Int32.Parse(oDomain.Get(intDomain, "environment"));
                AD             oAD       = new AD(intProfile, dsn, intDomain);
                DirectoryEntry oEntry    = oAD.UserSearch(strUser);
                Variables      oVariable = new Variables(intEnvironment);
                if (oEntry == null)
                {
                    strMemberships      = "<table id=\"tblMemberships\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">" + strMemberships + "</table>";
                    panContinue.Visible = true;
                    btnGroup.Attributes.Add("onclick", "return AJAXButtonGet(this,'" + txtGroup.ClientID + "','300','195','" + divGroup.ClientID + "','" + lstGroup.ClientID + "','" + hdnGroup.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_ad_groups.aspx',2,'" + divGroupMultiple.ClientID + "','" + intDomain.ToString() + "',null,'" + hdnGroups.ClientID + "','tblMemberships');");
                    lstGroup.Attributes.Add("ondblclick", "AJAXClickRow();");
                    try
                    {
                        txtFirst.Text = oProd.Properties["givenname"].Value.ToString();
                        txtLast.Text  = oProd.Properties["sn"].Value.ToString();
                    }
                    catch { }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The user account already exists.\\n\\nPlease enter a new account to continue.');<" + "/" + "script>");
                    btnNext.Enabled = false;
                }
            }
        }
Example #9
0
        protected void btnNext_Click(Object Sender, EventArgs e)
        {
            int intRequest = Int32.Parse(Request.QueryString["rid"]);
            int intItem    = Int32.Parse(lblItem.Text);
            int intNumber  = Int32.Parse(lblNumber.Text);
            int intDomain  = Int32.Parse(ddlDomain.SelectedItem.Value);

            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD             oAD    = new AD(intProfile, dsn, intDomain);
            DirectoryEntry oEntry = oAD.GroupSearch(txtGroup.Text);

            if (oEntry != null)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString() + "&invalid=true");
            }
            else
            {
                oGroupRequest.AddMaintenance(intRequest, intItem, intNumber, "CREATE", txtGroup.Text, Int32.Parse(ddlDomain.SelectedItem.Value));
                oGroupRequest.DeleteMaintenanceParameters(intRequest, intItem, intNumber);
                string strScope = "Domain Local";
                if (radGG.Checked == true)
                {
                    strScope = "Global";
                }
                if (radUG.Checked == true)
                {
                    strScope = "Universal";
                }
                oGroupRequest.AddMaintenanceParameter(intRequest, intItem, intNumber, strScope);
                string strType = "Security";
                if (radD.Checked == true)
                {
                    strType = "Distribution";
                }
                oGroupRequest.AddMaintenanceParameter(intRequest, intItem, intNumber, strType);
                oRequest.UpdateUnNamedRequest(intRequest, "Group Maintenance");
                oRequestItem.UpdateForm(intRequest, true);
                Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString());
            }
        }
Example #10
0
        protected void btnNext_Click(Object Sender, EventArgs e)
        {
            int intRequest = Int32.Parse(Request.QueryString["rid"]);
            int intItem    = Int32.Parse(lblItem.Text);
            int intNumber  = Int32.Parse(lblNumber.Text);
            int intDomain  = Int32.Parse(ddlDomain.SelectedItem.Value);

            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD             oAD    = new AD(intProfile, dsn, intDomain);
            DirectoryEntry oEntry = oAD.GroupSearch(txtGroup.Text);

            if (oEntry == null)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString() + "&invalid=true");
            }
            else
            {
                oGroupRequest.AddMaintenance(intRequest, intItem, intNumber, "DELETE", txtGroup.Text, Int32.Parse(ddlDomain.SelectedItem.Value));
                oRequest.UpdateUnNamedRequest(intRequest, "Group Maintenance");
                oRequestItem.UpdateForm(intRequest, true);
                Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString());
            }
        }
Example #11
0
        private void LoadObjects()
        {
            string strGroup = oFunction.decryptQueryString(Request.QueryString["g"]);

            txtFrom.Text = strGroup;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD oAD = new AD(intProfile, dsn, intDomain);

            lblGroup.Text = oAD.GetGroupName(strGroup);
            DirectoryEntry oEntry    = oAD.GroupSearch(strGroup);
            Variables      oVariable = new Variables(intDomain);

            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());
                        ListItem       oList   = new ListItem(oEntry2.Properties["displayName"].Value.ToString() + " (" + oEntry2.Properties["name"].Value.ToString() + ")", oEntry2.Properties["name"].Value.ToString());
                        chkUsers.Items.Add(oList);
                        oList.Selected = true;
                    }
                }
                lblNone.Visible = (chkUsers.Items.Count == 0);
                // Get Group Type
                if (oEntry.Properties.Contains("groupType") == true)
                {
                    switch (oEntry.Properties["groupType"].Value.ToString())
                    {
                    case "-2147483646":
                        radS.Checked  = true;
                        radGG.Checked = true;
                        break;

                    case "-2147483644":
                        radS.Checked   = true;
                        radDLG.Checked = true;
                        break;

                    case "-2147483640":
                        radS.Checked  = true;
                        radUG.Checked = true;
                        break;

                    case "2":
                        radD.Checked  = true;
                        radGG.Checked = true;
                        break;

                    case "4":
                        radD.Checked   = true;
                        radDLG.Checked = true;
                        break;

                    case "8":
                        radD.Checked  = true;
                        radUG.Checked = true;
                        break;
                    }
                }
                panContinue.Visible = true;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The group could not be found.\\n\\nPlease enter a group name to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
        }
Example #12
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();");
        }
Example #13
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);
                }
            }
        }
Example #14
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','');");
 }
Example #15
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);
            oForecast  = new Forecast(intProfile, dsn);
            oServer    = new Servers(intProfile, dsn);
            oOnDemand  = new OnDemand(intProfile, dsn);
            oClass     = new Classes(intProfile, dsn);
            if (Request.QueryString["duplicate"] != null && Request.QueryString["duplicate"] != "")
            {
                Page.ClientScript.RegisterStartupScript(typeof(Page), "duplicate", "<script type=\"text/javascript\">alert('The account " + Request.QueryString["duplicate"] + " already exists');<" + "/" + "script>");
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intServer  = Int32.Parse(Request.QueryString["id"]);
                Page.Title = "ClearView Account Configuration | Server # " + intServer.ToString();
                DataSet ds = oServer.Get(intServer);
                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());
                    int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
                    intRequest = oForecast.GetRequestID(intAnswer, true);
                    intDomain  = Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString());
                    Domains oDomain     = new Domains(intProfile, dsn);
                    bool    boolProcess = true;
                    if (oDomain.Get(intDomain, "account_setup") != "1")
                    {
                        if (oForecast.GetAnswer(intAnswer, "test") == "1")
                        {
                            intDomain = Int32.Parse(ds.Tables[0].Rows[0]["test_domainid"].ToString());
                        }
                        else
                        {
                            boolProcess = false;
                        }
                    }
                    if (boolProcess == false)
                    {
                        btnAdd.Enabled = false;
                    }
                    lblDomain.Text = oDomain.Get(intDomain, "name");
                    bool boolPNC = (oClass.Get(intClass, "pnc") == "1");
                    if (boolPNC == true)
                    {
                        panPNC.Visible = true;
                        txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2,null,'PNC');");
                    }
                    else
                    {
                        txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2,null,'NCB');");
                        panNCB.Visible = true;
                    }
                    Requests oRequest = new Requests(intProfile, dsn);
                    //if (oRequest.GetUser(intRequest) == intProfile)
                    //{
                    panPermit.Visible = true;
                    lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
                    chkAdmin.Attributes.Add("onclick", "CheckAdmin(this);");
                    ds = oServer.GetAccounts(intServer);
                    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?');");
                        Label  _local         = (Label)ri.FindControl("lblLocal");
                        Label  _domain        = (Label)ri.FindControl("lblDomain");
                        string strPermissions = "";
                        Label  _permissions   = (Label)ri.FindControl("lblPermissions");
                        if (boolPNC == true)
                        {
                            char[] strAccountSplit = { ';' };

                            // Domain Groups
                            string[] strAccountDomainArray = _domain.Text.Split(strAccountSplit);
                            for (int jj = 0; jj < strAccountDomainArray.Length; jj++)
                            {
                                string strAccountDomain = strAccountDomainArray[jj].Trim();
                                if (strAccountDomain.Contains("_") == true)
                                {
                                    strPermissions  += strAccountDomain.Substring(0, strAccountDomain.IndexOf("_"));
                                    strAccountDomain = strAccountDomain.Substring(strAccountDomain.IndexOf("_") + 1);
                                    if (strAccountDomain == "1")
                                    {
                                        strPermissions += " (Remote Desktop)";
                                    }
                                }
                                else
                                {
                                    strPermissions += strAccountDomain;
                                }
                                strPermissions += "<br/>";
                            }

                            // Local Groups
                            string[] strAccountLocalArray = _local.Text.Split(strAccountSplit);
                            for (int jj = 0; jj < strAccountLocalArray.Length; jj++)
                            {
                                string strAccountLocal = strAccountLocalArray[jj].Trim();
                                if (strAccountLocal.Contains("_") == true)
                                {
                                    strPermissions += strAccountLocal.Substring(0, strAccountLocal.IndexOf("_"));
                                    strAccountLocal = strAccountLocal.Substring(strAccountLocal.IndexOf("_") + 1);
                                    if (strAccountLocal == "1")
                                    {
                                        strPermissions += " (Remote Desktop)";
                                    }
                                }
                                else
                                {
                                    strPermissions += strAccountLocal;
                                }
                                strPermissions += "<br/>";
                            }
                        }
                        else
                        {
                            Label  _admin        = (Label)ri.FindControl("lblAdmin");
                            string strPermission = _admin.Text;
                            if (strPermission == "1")
                            {
                                strPermissions += "ADMINISTRATOR<br/>";
                            }
                            strPermission = _local.Text;
                            if (strPermission.Contains("GLCfsaRO_SysVol"))
                            {
                                strPermissions += "SYS_VOL (C:) - Read Only<br/>";
                            }
                            else if (strPermission.Contains("GLCfsaRW_SysVol"))
                            {
                                strPermissions += "SYS_VOL (C:) - Read / Write<br/>";
                            }
                            else if (strPermission.Contains("GLCfsaFC_SysVol"))
                            {
                                strPermissions += "SYS_VOL (C:) - Full Control<br/>";
                            }
                            if (strPermission.Contains("GLCfsaRO_UtlVol"))
                            {
                                strPermissions += "UTL_VOL (E:) - Read Only<br/>";
                            }
                            else if (strPermission.Contains("GLCfsaRW_UtlVol"))
                            {
                                strPermissions += "UTL_VOL (E:) - Read / Write<br/>";
                            }
                            else if (strPermission.Contains("GLCfsaFC_UtlVol"))
                            {
                                strPermissions += "UTL_VOL (E:) - Full Control<br/>";
                            }
                            if (strPermission.Contains("GLCfsaRO_AppVol"))
                            {
                                strPermissions += "APP_VOL (F:) - Read Only<br/>";
                            }
                            else if (strPermission.Contains("GLCfsaRW_AppVol"))
                            {
                                strPermissions += "APP_VOL (F:) - Read / Write<br/>";
                            }
                            else if (strPermission.Contains("GLCfsaFC_AppVol"))
                            {
                                strPermissions += "APP_VOL (F:) - Full Control<br/>";
                            }
                        }
                        if (strPermissions == "")
                        {
                            strPermissions = "-----";
                        }
                        _permissions.Text = strPermissions;
                    }
                    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;");
                    }
                    //}
                    //else
                    //    panDenied.Visible = true;
                }
            }
            else
            {
                panDenied.Visible = true;
            }
            btnSkip.Attributes.Add("onclick", "return confirm('Are you sure you want to skip the account request 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','');");
            chkDeveloper.Attributes.Add("onclick", "SwapChecks(this,'" + chkPromoter.ClientID + "');");
            chkPromoter.Attributes.Add("onclick", "SwapChecks(this,'" + chkDeveloper.ClientID + "');");
        }
Example #16
0
        public List <CompiledData> Extract(string pathFiles)
        {
            Console.WriteLine("Extracting Data ");

            char[] separator           = { ' ' };
            string separatorDomainCode = ".";
            string separatorFileName   = "-";
            int    viewCount           = 0;
            int    responseSize        = 0;
            int    found = 0;

            var compiledList = new List <CompiledData>();

            try
            {
                DirectoryInfo directorySelected = new DirectoryInfo(pathFiles);

                foreach (FileInfo fileToRead in directorySelected.GetFiles("*.*"))
                {
                    Console.WriteLine($"Working on File: {fileToRead.Name}");

                    var period   = fileToRead.FullName.Split(separatorFileName);
                    var allLines = File.ReadAllLines(fileToRead.FullName);
                    foreach (var currentLine in allLines)
                    {
                        var periodHour = period[2].Substring(0, 2);

                        string[] splitCurrentLine = currentLine.Split(separator);

                        var domainCode = splitCurrentLine[0];
                        var pageTitle  = splitCurrentLine[1];
                        viewCount    = Convert.ToInt32(splitCurrentLine[2]);
                        responseSize = Convert.ToInt32(splitCurrentLine[3]);
                        string language = null;
                        string domain   = null;

                        found = domainCode.IndexOf(separatorDomainCode);
                        if (found < 0)
                        {
                            language = splitCurrentLine[0];;
                            domain   = "Wikipedia";
                        }
                        else
                        {
                            string[] splitDomainCode = domainCode.Split(separatorDomainCode);
                            language = splitDomainCode.First();
                            var smallDomain = splitDomainCode.Last();
                            domain = Domains.Get().Where(x => x.GetCode() == smallDomain).FirstOrDefault().GetName();
                        }
                        var compiledData = new CompiledData(domainCode, language, domain, pageTitle, viewCount, responseSize, periodHour, currentLine);
                        compiledList.Add(compiledData);
                    }
                    ;
                }
            }
            catch (Exception Ex)
            {
                Console.WriteLine(Ex);
            }

            return(compiledList);
        }
Example #17
0
        private bool LoadInformation(int _request_workflow)
        {
            if (intProject > 0)
            {
                lblName.Text   = oProject.Get(intProject, "name");
                lblNumber.Text = oProject.Get(intProject, "number");
                lblType.Text   = "Project";
            }
            else
            {
                lblName.Text   = oResourceRequest.GetWorkflow(_request_workflow, "name");
                lblNumber.Text = "CVT" + intRequest.ToString();
                lblType.Text   = "Task";
            }
            bool    boolDone = false;
            DataSet ds       = oOnDemandTasks.GetVirtualII(intRequest, intItem, intNumber);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Forecast oForecast = new Forecast(intProfile, dsn);
                int      intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                lblAnswer.Text = intAnswer.ToString();
                btnView.Attributes.Add("onclick", "return OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');");
                //btnBirth.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                //btnSC.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                lblView.Text = oOnDemandTasks.GetBody(intAnswer, intImplementorDistributed, intImplementorMidrange);
                int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                Models oModel     = new Models(intProfile, dsn);
                int    intType    = Int32.Parse(oModel.Get(intModel, "typeid"));
                Types  oType      = new Types(intProfile, dsn);
                string strExecute = oType.Get(intType, "forecast_execution_path");
                if (strExecute != "")
                {
                    btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                }
                chk1.Checked  = (ds.Tables[0].Rows[0]["chk1"].ToString() == "1");
                chk2.Checked  = (ds.Tables[0].Rows[0]["chk2"].ToString() == "1");
                txtSCID.Text  = ds.Tables[0].Rows[0]["scid"].ToString();
                chk3.Checked  = (ds.Tables[0].Rows[0]["chk3"].ToString() == "1");
                chk4.Checked  = (ds.Tables[0].Rows[0]["chk4"].ToString() == "1");
                boolDone      = (chk1.Checked && chk2.Checked && chk3.Checked && chk4.Checked);
                img1.ImageUrl = "/images/green_arrow.gif";
                if (chk1.Checked == true)
                {
                    btnExecute.Enabled = false;
                    img1.ImageUrl      = "/images/check.gif";
                    img2.ImageUrl      = "/images/green_arrow.gif";
                    chk2.Enabled       = true;
                    Servers oServer  = new Servers(intProfile, dsn);
                    DataSet dsAnswer = oServer.GetAnswer(intAnswer);
                    foreach (DataRow drAnswer in dsAnswer.Tables[0].Rows)
                    {
                        if (lbl1.Text != "")
                        {
                            lbl1.Text += "<br/>";
                        }
                        int        intServerName = Int32.Parse(drAnswer["nameid"].ToString());
                        ServerName oServerName   = new ServerName(0, dsn);
                        lbl1.Text += "Server Name: " + oservername.getname2(intServerName, 0) + "<br/>";
                        int     intServer = Int32.Parse(drAnswer["id"].ToString());
                        Zeus    oZeus     = new Zeus(intProfile, dsnZeus);
                        DataSet dsZeus    = oZeus.GetBuildServer(intServer);
                        if (dsZeus.Tables[0].Rows.Count > 0)
                        {
                            lbl1.Text += "Serial Number: " + dsZeus.Tables[0].Rows[0]["serial"].ToString() + "<br/>";
                        }
                        int     intDomain = Int32.Parse(drAnswer["domainid"].ToString());
                        Domains oDomain   = new Domains(intProfile, dsn);
                        boolMove = (oDomain.Get(intDomain, "move") == "1");
                        if (boolMove == true)
                        {
                            lbl1.Text += "DHCP Address: " + drAnswer["dhcp"].ToString() + "<br/>";
                        }
                        int         intIPAddress = 0;
                        IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);
                        if (drAnswer["ipaddressid"].ToString() != "")
                        {
                            intIPAddress = Int32.Parse(drAnswer["ipaddressid"].ToString());
                            lbl1.Text   += "Assigned IP Address: " + oIPAddresses.GetName(intIPAddress, 0) + "<br/>";
                        }
                        if (drAnswer["ipaddressid_final"].ToString() != "")
                        {
                            intIPAddress = Int32.Parse(drAnswer["ipaddressid_final"].ToString());
                            lbl1.Text   += "Final IP Address: " + oIPAddresses.GetName(intIPAddress, 0) + "<br/>";
                        }
                    }
                }
            }
            if (boolMove == false)
            {
            }
            if (chk2.Checked == true)
            {
                chk1.Enabled  = false;
                img2.ImageUrl = "/images/check.gif";
                img3.ImageUrl = "/images/green_arrow.gif";
                chk3.Enabled  = true;
            }
            if (chk3.Checked == true)
            {
                chk2.Enabled  = false;
                img3.ImageUrl = "/images/check.gif";
                img4.ImageUrl = "/images/green_arrow.gif";
                chk4.Enabled  = true;
            }
            if (chk4.Checked == true)
            {
                chk3.Enabled  = false;
                img4.ImageUrl = "/images/check.gif";
            }
            if (Request.QueryString["div"] != null)
            {
                switch (Request.QueryString["div"])
                {
                case "E":
                    boolExecution = true;
                    break;
                }
            }
            if (boolDetails == false && boolExecution == false)
            {
                boolDetails = true;
            }
            return(boolDone);
        }
        protected void btnApprove_Click(Object Sender, EventArgs e)
        {
            oResourceRequest.UpdateWorkflowHours(intResourceWorkflow);
            DataSet ds             = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
            int     intUser        = oRequest.GetUser(intRequest);
            DataSet dsParameters   = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
            string  strMaintenance = ds.Tables[0].Rows[0]["maintenance"].ToString();
            string  strUser        = ds.Tables[0].Rows[0]["username"].ToString();
            int     intDomain      = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
            Domains oDomain        = new Domains(intProfile, dsn);

            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD             oAD       = new AD(intProfile, dsn, intDomain);
            Variables      oVariable = new Variables(intDomain);
            DirectoryEntry oEntry    = oAD.UserSearch(strUser);

            if (oEntry != null)
            {
                switch (strMaintenance)
                {
                case "DISABLE":
                    // Account Disable
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Disable", oAD.Enable(oEntry, false), "Account " + strUser + " was successfully disabled", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "UNLOCK":
                    // Account Unlock
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Unlock", oAD.Unlock(oEntry), "Account " + strUser + " was successfully unlocked", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "ENABLE":
                    // Account Enable
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Enable", oAD.Enable(oEntry, true), "Account " + strUser + " was successfully enabled", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "EMAIL":
                    // Account Email
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Email", oAD.CreateMailbox(oEntry), "Account " + strUser + " was successfully created a mailbox", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "MOVE":
                    // Account Move
                    string strPath = dsParameters.Tables[0].Rows[0]["value"].ToString();
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Move", oAD.MoveAccount(oEntry, strPath), "Account " + strUser + " was successfully moved", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "PASSWORD":
                    // Account Password Change
                    Encryption oEncrypt    = new Encryption();
                    string     strPassword = dsParameters.Tables[0].Rows[0]["value"].ToString();
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Password Change", oAD.SetPassword(oEntry, oEncrypt.Decrypt(strPassword, "adpass")), "The password for account " + strUser + " was successfully changed", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "COPY":
                    // Account Copy
                    string strID    = txtID.Text;
                    string strFirst = txtFirst.Text;
                    string strLast  = txtLast.Text;
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Copy", oAD.CreateUser(strID, strFirst, strLast, txtPassword.Text, "", "Created by ClearView - " + DateTime.Now.ToShortDateString(), oVariable.UserOU()), "Account " + strUser + " was successfully copied", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    foreach (ListItem oList in chkGroups.Items)
                    {
                        if (oList.Selected == true)
                        {
                            oRequest.AddResult(intRequest, intItem, intNumber, "Group Membership", oAD.JoinGroup(strID, oList.Value, 0), "Account " + strUser + " was successfully added to the group " + oList.Value, intEnvironment, (oService.Get(intService, "notify_client") == "1"), "");
                        }
                    }
                    break;

                case "DELETE":
                    // Account Deletion
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Deletion", oAD.Delete(oEntry), "Account " + strUser + " was successfully deleted", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "RENAME":
                    // Account Rename
                    string strI = txtID.Text;
                    string strF = txtFirst.Text;
                    string strL = txtLast.Text;
                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Rename", oAD.Rename(oEntry, strI, strF, strL), "Account " + strUser + " was successfully renamed", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;
                }
            }
            oAccountRequest.UpdateMaintenance(intRequest, intItem, intNumber, 1, txtComments.Text);
            Complete();
        }
Example #19
0
        private void AddDevice(string _type, string _name, string _count, int _clusterid, int _csmconfigid, int _number)
        {
            boolOther   = !boolOther;
            strDevices += "<tr" + (boolOther ? " bgcolor=\"F6F6F6\"" : "") + ">";
            strDevices += "<td>" + _type + "</td>";
            strDevices += "<td>" + _name + "</td>";
            strDevices += "<td>" + _count + "</td>";
            DataSet ds = oServer.Get(intID, _csmconfigid, _clusterid, _number);
            bool    boolDeviceConfigured = true;

            if (ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows[0]["configured"].ToString() != "1")
            {
                boolDeviceConfigured = false;
            }
            if (boolDeviceConfigured == true)
            {
                strDevices += "<td nowrap align=\"center\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" onclick=\"OpenOnDemandDevice(" + intID + "," + _clusterid.ToString() + "," + _csmconfigid.ToString() + "," + _number.ToString() + ");\"/></td>";
            }
            else
            {
                strDevices    += "<td nowrap align=\"center\"><img src=\"/images/required.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" onclick=\"OpenOnDemandDevice(" + intID + "," + _clusterid.ToString() + "," + _csmconfigid.ToString() + "," + _number.ToString() + ");\"/></td>";
                boolConfigured = false;
            }
            strDevices += "<td>&nbsp;</td>";
            if (ds.Tables[0].Rows.Count == 0)
            {
                strDevices    += "<td nowrap align=\"center\"><input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" disabled /></td>";
                boolConfigured = false;
            }
            else
            {
                Domains oDomain   = new Domains(0, dsn);
                int     intDomain = Int32.Parse(ds.Tables[0].Rows[0]["test_domainid"].ToString());
                if (intDomain == 0)
                {
                    intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString());
                }
                if (oDomain.Get(intDomain, "account_setup") == "1" && oForecast.IsOSDistributed(intID) == true)
                {
                    if (ds.Tables[0].Rows[0]["accounts"].ToString() == "0")
                    {
                        strDevices    += "<td nowrap align=\"center\"><img src=\"/images/required.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" onclick=\"OpenWindow('NEW_WINDOW','/frame/ondemand/accounts_new.aspx?id=" + ds.Tables[0].Rows[0]["id"].ToString() + "');\"/></td>";
                        boolConfigured = false;
                    }
                    else
                    {
                        strDevices += "<td nowrap align=\"center\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" onclick=\"OpenWindow('NEW_WINDOW','/frame/ondemand/accounts_new.aspx?id=" + ds.Tables[0].Rows[0]["id"].ToString() + "');\"/></td>";
                    }
                }
                else
                {
                    if (ds.Tables[0].Rows[0]["accounts"].ToString() == "0")
                    {
                        oServer.UpdateAccounts(Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()), 1);
                    }
                    strDevices += "<td nowrap align=\"center\"><input type=\"button\" class=\"default\" value=\"N / A\" style=\"width:50px\" disabled /></td>";
                }
            }
            strDevices += "<td>&nbsp;</td>";
            if (oForecast.IsStorage(intID) == true)
            {
                bool boolDeviceStorage = true;
                if (ds.Tables[0].Rows.Count == 0 || Int32.Parse(ds.Tables[0].Rows[0]["local_storage"].ToString()) == 0 || (Int32.Parse(ds.Tables[0].Rows[0]["local_storage"].ToString()) == 1 && Int32.Parse(ds.Tables[0].Rows[0]["fdrive"].ToString()) == 0))
                {
                    boolDeviceStorage = false;
                }
                if (boolDeviceStorage == true)
                {
                    strDevices += "<td nowrap align=\"center\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" " + (boolDeviceConfigured == false ? "disabled " : "") + "onclick=\"OpenOnDemandStorage(" + intID + "," + _clusterid.ToString() + "," + _csmconfigid.ToString() + "," + _number.ToString() + ");\"/></td>";
                }
                else
                {
                    strDevices    += "<td nowrap align=\"center\"><img src=\"/images/required.gif\" border=\"0\" align=\"absmiddle\"/> <input type=\"button\" class=\"default\" value=\"Edit\" style=\"width:50px\" " + (boolDeviceConfigured == false ? "disabled " : "") + "onclick=\"OpenOnDemandStorage(" + intID + "," + _clusterid.ToString() + "," + _csmconfigid.ToString() + "," + _number.ToString() + ");\"/></td>";
                    boolConfigured = false;
                }
            }
            else
            {
                strDevices += "<td nowrap align=\"center\"><input type=\"button\" class=\"default\" value=\"N / A\" style=\"width:50px\" disabled /></td>";
            }
            strDevices += "</tr>";
        }
Example #20
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','');");
        }
        private void LoadObjects()
        {
            string strUser = oFunction.decryptQueryString(Request.QueryString["u"]);

            txtID.Text = strUser;
            int intDomain = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["d"]));

            ddlDomain.SelectedValue = intDomain.ToString();
            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD             oAD       = new AD(intProfile, dsn, intDomain);
            DirectoryEntry oEntry    = oAD.UserSearch(strUser);
            Variables      oVariable = new Variables(intEnvironment);

            if (oEntry != null)
            {
                if (oEntry.Properties.Contains("distinguishedName") == true)
                {
                    lblLocation.Text = oEntry.Properties["distinguishedName"].Value.ToString();
                }
                if (oEntry.Properties.Contains("givenname") == true)
                {
                    txtFirst.Text = oEntry.Properties["givenname"].Value.ToString();
                }
                if (oEntry.Properties.Contains("sn") == true)
                {
                    txtLast.Text = oEntry.Properties["sn"].Value.ToString();
                }
                if (oEntry.Properties.Contains("whencreated") == true)
                {
                    lblCreated.Text = oEntry.Properties["whencreated"].Value.ToString();
                }
                if (oEntry.Properties.Contains("whenchanged") == true)
                {
                    lblModified.Text = oEntry.Properties["whenchanged"].Value.ToString();
                }
                if (oAD.IsDisabled(oEntry) == true)
                {
                    lblDisabled.Text  = "Yes <img src='/images/required.gif' border='0' align='absmiddle'/>";
                    chkEnable.Visible = true;
                }
                else
                {
                    lblDisabled.Text = "No";
                }
                if (oAD.IsLocked(oEntry) == true)
                {
                    lblLocked.Text    = "Yes <img src='/images/required.gif' border='0' align='absmiddle'/>";
                    chkUnlock.Visible = true;
                }
                else
                {
                    lblLocked.Text = "No";
                }
                string   strGroups = oAD.GetGroups(oEntry);
                string[] strGroup;
                char[]   strSplit = { ';' };
                strGroup = strGroups.Split(strSplit);
                // Add Groups
                for (int ii = 0; ii < strGroup.Length; ii++)
                {
                    if (strGroup[ii].Trim() != "")
                    {
                        strMemberships  += "<tr><td>" + strGroup[ii].Trim() + "</td><td>[<a href=\"javascript:void(0);\" onclick=\"DeleteList(this,'" + strGroup[ii].Trim() + "','" + hdnGroups.ClientID + "');\">Delete</a>]</td></tr>";
                        hdnGroups.Value += strGroup[ii].Trim() + ";";
                    }
                }
                strMemberships      = "<table id=\"tblMemberships\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">" + strMemberships + "</table>";
                panContinue.Visible = true;
                btnGroup.Attributes.Add("onclick", "return AJAXButtonGet(this,'" + txtGroup.ClientID + "','300','195','" + divGroup.ClientID + "','" + lstGroup.ClientID + "','" + hdnGroup.ClientID + "','" + oVariable.URL() + "/frame/ajax/ajax_ad_groups.aspx',2,'" + divGroupMultiple.ClientID + "','" + intDomain.ToString() + "',null,'" + hdnGroups.ClientID + "','tblMemberships');");
                lstGroup.Attributes.Add("ondblclick", "AJAXClickRow();");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('The user account could not be found.\\n\\nPlease enter a valid account to continue.');<" + "/" + "script>");
                btnNext.Enabled = false;
            }
        }
Example #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(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;
                        StringBuilder sbResult    = new StringBuilder(oService.GetName(intService) + " Completed");
                        StringBuilder sbError     = new StringBuilder(oService.GetName(intService) + " Error");

                        // ********* BEGIN PROCESSING **************
                        AccountRequest oAccountRequest = new AccountRequest(intProfile, dsn);
                        Requests       oRequest        = new Requests(intProfile, dsn);
                        Users          oUser           = new Users(intProfile, dsn);
                        DataSet        ds      = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                        Domains        oDomain = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string         strUser      = ds.Tables[0].Rows[0]["username"].ToString();
                            int            intDomain    = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                            int            intEnv       = Int32.Parse(oDomain.Get(intDomain, "environment"));
                            int            intUser      = oRequest.GetUser(intRequest);
                            DataSet        dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
                            AD             oAD          = new AD(intProfile, dsn, intEnv);
                            DirectoryEntry oEntry       = oAD.UserSearch(strUser);

                            if (oEntry == null)
                            {
                                sbResult = new StringBuilder();
                            }
                            else
                            {
                                sbError = new StringBuilder();

                                string strFirstOld = "";
                                if (oEntry.Properties.Contains("givenname") == true)
                                {
                                    strFirstOld = oEntry.Properties["givenname"].Value.ToString();
                                }
                                string strLastOld = "";
                                if (oEntry.Properties.Contains("sn") == true)
                                {
                                    strLastOld = oEntry.Properties["sn"].Value.ToString();
                                }
                                string strFirstNew        = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                string strLastNew         = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                string strEnable          = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                string strUnlock          = dsParameters.Tables[0].Rows[3]["value"].ToString();
                                string strGroupsRequested = dsParameters.Tables[0].Rows[4]["value"].ToString();
                                if (strFirstOld != strFirstNew || strLastOld != strLastNew)
                                {
                                    if (strFirstOld != strFirstNew && strLastOld != strLastNew)
                                    {
                                        oEntry.Properties["givenname"].Value   = strFirstNew;
                                        oEntry.Properties["sn"].Value          = strLastNew;
                                        oEntry.Properties["displayname"].Value = strLastNew + ", " + strFirstNew;
                                        oEntry.CommitChanges();
                                        sbResult.Append("<p>The first name and last name for account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully updated</p>");
                                    }
                                    else if (strFirstOld != strFirstNew)
                                    {
                                        oEntry.Properties["givenname"].Value   = strFirstNew;
                                        oEntry.Properties["displayname"].Value = strLastNew + ", " + strFirstNew;
                                        oEntry.CommitChanges();
                                        sbResult.Append("<p>The first name for account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully updated</p>");
                                    }
                                    else
                                    {
                                        oEntry.Properties["sn"].Value          = strLastNew;
                                        oEntry.Properties["displayname"].Value = strLastNew + ", " + strFirstNew;
                                        oEntry.CommitChanges();
                                        sbResult.Append("<p>The last name for account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully updated</p>");
                                    }
                                }
                                if (strEnable == "1")
                                {
                                    strEnable = oAD.Enable(oEntry, true);
                                    if (strEnable == "")
                                    {
                                        sbResult.Append("<p>The user account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully enabled</p>");
                                    }
                                    else
                                    {
                                        sbError.Append("<p>The user account ");
                                        sbError.Append(strUser);
                                        sbError.Append(" was NOT successfully enabled</p>");
                                    }
                                }
                                if (strUnlock == "1")
                                {
                                    strUnlock = oAD.Unlock(oEntry);
                                    if (strUnlock == "")
                                    {
                                        sbResult.Append("<p>The user account ");
                                        sbResult.Append(strUser);
                                        sbResult.Append(" was successfully unlocked</p>");
                                    }
                                    else
                                    {
                                        sbError.Append("<p>The user account ");
                                        sbError.Append(strUser);
                                        sbError.Append(" was NOT successfully unlocked</p>");
                                    }
                                }

                                string   strGroupsExist = oAD.GetGroups(oEntry);
                                string[] strGroupRequested;
                                string[] strGroupExist;
                                char[]   strSplit = { ';' };
                                strGroupRequested = strGroupsRequested.Split(strSplit);
                                strGroupExist     = strGroupsExist.Split(strSplit);

                                // Add Groups
                                for (int ii = 0; ii < strGroupRequested.Length; ii++)
                                {
                                    if (strGroupRequested[ii].Trim() != "")
                                    {
                                        bool boolExist = false;
                                        for (int jj = 0; jj < strGroupExist.Length; jj++)
                                        {
                                            if (strGroupExist[jj].Trim() != "" && strGroupRequested[ii].Trim() == strGroupExist[jj].Trim())
                                            {
                                                boolExist = true;
                                                break;
                                            }
                                        }
                                        if (boolExist == false)
                                        {
                                            // Add the group
                                            string strJoin = oAD.JoinGroup(strUser, strGroupRequested[ii].Trim(), 0);
                                            if (strJoin == "")
                                            {
                                                sbResult.Append("<p>The user ");
                                                sbResult.Append(strUser);
                                                sbResult.Append(" was successfully joined to the group ");
                                                sbResult.Append(strGroupRequested[ii].Trim());
                                                sbResult.Append("</p>");
                                            }
                                            else
                                            {
                                                sbError.Append("<p>The user ");
                                                sbError.Append(strUser);
                                                sbError.Append(" was NOT successfully joined to the group ");
                                                sbError.Append(strGroupRequested[ii].Trim());
                                                sbError.Append(" : ");
                                                sbError.Append(strJoin);
                                                sbError.Append("</p>");
                                            }
                                        }
                                    }
                                }
                                // Remove Groups
                                for (int ii = 0; ii < strGroupExist.Length; ii++)
                                {
                                    if (strGroupExist[ii].Trim() != "")
                                    {
                                        bool boolExist = false;
                                        for (int jj = 0; jj < strGroupRequested.Length; jj++)
                                        {
                                            if (strGroupRequested[jj].Trim() != "" && strGroupExist[ii].Trim() == strGroupRequested[jj].Trim())
                                            {
                                                boolExist = true;
                                                break;
                                            }
                                        }
                                        if (boolExist == false)
                                        {
                                            // Remove the group
                                            string strJoin = oAD.RemoveGroup(strUser, strGroupExist[ii].Trim());
                                            if (strJoin == "")
                                            {
                                                sbResult.Append("<p>The user ");
                                                sbResult.Append(strUser);
                                                sbResult.Append(" was successfully removed from the group ");
                                                sbResult.Append(strGroupExist[ii].Trim());
                                                sbResult.Append("</p>");
                                            }
                                            else
                                            {
                                                sbError.Append("<p>The user ");
                                                sbError.Append(strUser);
                                                sbError.Append(" was NOT successfully removed from the group ");
                                                sbError.Append(strGroupExist[ii].Trim());
                                                sbError.Append(" : ");
                                                sbError.Append(strJoin);
                                                sbError.Append("</p>");
                                            }
                                        }
                                    }
                                }
                                oRequest.AddResult(intRequest, intItem, intNumber, "Account Modification", sbError.ToString(), sbResult.ToString(), intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                            }
                        }

                        if (sbResult.ToString() == "")
                        {
                            boolSuccess = false;
                        }

                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + sbResult.ToString() + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + sbError.ToString() + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
Example #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/domains_dns.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");
            }
            oDomain   = new Domains(intProfile, dsn);
            oClass    = new Classes(intProfile, dsn);
            oLocation = new Locations(intProfile, dsn);

            if (Request.QueryString["domainid"] != null)
            {
                intDomain = Int32.Parse(Request.QueryString["domainid"]);
            }
            if (Request.QueryString["parent"] != null)
            {
                intClass = Int32.Parse(Request.QueryString["parent"]);
            }

            if (Request.QueryString["id"] == null && intClass == 0)
            {
                LoadDomains();
            }
            else
            {
                if (intClass > 0)
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                }
                else
                {
                    intID          = Int32.Parse(Request.QueryString["id"]);
                    panAdd.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds = oDomain.GetClassDNS(intID);
                        intDomain     = Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString());
                        intClass      = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                        intLocation   = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString());
                        txtDNS1.Text  = ds.Tables[0].Rows[0]["dns_ip1"].ToString();
                        txtDNS2.Text  = ds.Tables[0].Rows[0]["dns_ip2"].ToString();
                        txtDNS3.Text  = ds.Tables[0].Rows[0]["dns_ip3"].ToString();
                        txtDNS4.Text  = ds.Tables[0].Rows[0]["dns_ip4"].ToString();
                        txtWINS1.Text = ds.Tables[0].Rows[0]["wins_ip1"].ToString();
                        txtWINS2.Text = ds.Tables[0].Rows[0]["wins_ip2"].ToString();
                        txtWINS3.Text = ds.Tables[0].Rows[0]["wins_ip3"].ToString();
                        txtWINS4.Text = ds.Tables[0].Rows[0]["wins_ip4"].ToString();
                        btnAdd.Text   = "Update";
                    }
                }
                lblDomain.Text = oDomain.Get(intDomain, "name");
                lblClass.Text  = oClass.Get(intClass, "name");
                if (!IsPostBack)
                {
                    strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
                    hdnLocation.Value = intLocation.ToString();
                }
            }
        }
Example #24
0
        public JsonResult AddField(String Name, String FieldType, String Comment, String PossibleValues, String SelectText, String IsMandatory, String ShowInSignup, String SortValues, String IsActive, String AdminUseOnly, String VerticalLayout, int FieldGroupID, bool Encrypted, int[] SelectedDomains, int[] SelectedRoles)
        {
            ProfileField profileField = ProfileFields.GetByName(Name);
            String       Message      = "";

            if (profileField.FieldID > 0 && profileField.FieldName.Trim().ToLower() == Name.Trim().ToLower())
            {
                Message = "The field \"" + Name + "\" already exists.";
            }

            if (Name.Trim().ToLower().Length == 0)
            {
                Message = "The field name should not be empty.";
            }

            if (Message != "")
            {
                RequestResultModel _model = new RequestResultModel();
                _model.InfoType = RequestResultInfoType.ErrorOrDanger;
                _model.Message  = Message;

                AuditEvent.AppEventWarning(Profile.Member.Email, Message);

                return(Json(new
                {
                    NotifyType = NotifyType.DialogInline,
                    Html = this.RenderPartialView(@"_RequestResultDialogInLine", _model),
                }, JsonRequestBehavior.AllowGet));
            }


            profileField.FieldName       = Name;
            profileField.Comment         = Comment;
            profileField.FieldTypeID     = (ProfileFieldTypeEnum)int.Parse(FieldType);
            profileField.PossibleValues  = PossibleValues;
            profileField.TextSelectValue = SelectText;
            profileField.IsMandatory     = (IsMandatory == "True" ? 1 : 0);
            profileField.ShowInSignUp    = (ShowInSignup == "True" ? 1 : 0);
            profileField.SortValues      = SortValues == "True" ? 1 : 0;
            profileField.IsActive        = IsActive == "True" ? 1 : 0;
            profileField.AdminUseOnly    = AdminUseOnly == "True" ? 1 : 0;
            profileField.VerticalLayout  = VerticalLayout == "True" ? 1 : 0;
            profileField.FieldGroupID    = FieldGroupID;
            profileField.Encrypted       = Encrypted == true ? 1 : 0;
            profileField.Save();

            if (SelectedDomains != null)
            {
                List <Domain> _domains = Domains.Get();
                foreach (Domain _domain in _domains)
                {
                    DomainProfileField _domainField = new DomainProfileField();
                    _domainField.DomainID       = _domain.DomainID;
                    _domainField.ProfileFieldID = profileField.FieldID;

                    if (SelectedDomains.Where(t => t == _domain.DomainID).FirstOrDefault() != default(int))
                    {
                        _domainField.Save();
                    }
                }
            }

            if (SelectedRoles != null)
            {
                List <Role> _roles = Web.Admin.Logic.Collections.Roles.Get();
                foreach (Role _role in _roles)
                {
                    RoleProfileField _roleField = new RoleProfileField();
                    _roleField.RoleID         = _role.RoleID;
                    _roleField.ProfileFieldID = profileField.FieldID;

                    if (SelectedRoles.Where(t => t == _role.RoleID).FirstOrDefault() != default(int))
                    {
                        _roleField.Save();
                    }
                }
            }

            AuditEvent.AppEventSuccess(Profile.Member.Email, String.Format("The \"{0}\" field has been added.", Name));

            return(Json(new
            {
                NotifyType = -1,
                Html = "",
            }, JsonRequestBehavior.AllowGet));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(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 **************
                        AccountRequest oAccountRequest = new AccountRequest(intProfile, dsn);
                        Requests       oRequest        = new Requests(intProfile, dsn);
                        Users          oUser           = new Users(intProfile, dsn);
                        DataSet        ds      = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                        Domains        oDomain = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string         strUser      = ds.Tables[0].Rows[0]["username"].ToString();
                            int            intDomain    = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                            int            intEnv       = Int32.Parse(oDomain.Get(intDomain, "environment"));
                            int            intUser      = oRequest.GetUser(intRequest);
                            DataSet        dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
                            AD             oAD          = new AD(intProfile, dsn, intEnv);
                            Variables      oVariable    = new Variables(intEnv);
                            DirectoryEntry oEntry       = oAD.UserSearch(strUser);
                            if (oEntry != null)
                            {
                                strResult = "<p>The account " + strUser + " already exists in " + oDomain.Get(intDomain, "name") + "</p>";
                            }
                            else
                            {
                                strError = "";
                                Encryption oEncrypt     = new Encryption();
                                string     strFirst     = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                string     strLast      = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                string     strEmail     = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                string     strTechnical = dsParameters.Tables[0].Rows[3]["value"].ToString();
                                string     strPassword  = oEncrypt.Decrypt(dsParameters.Tables[0].Rows[4]["value"].ToString(), "adpass");
                                if (strTechnical == "1")
                                {
                                    strResult = oAD.CreateUser(strUser, strFirst, strLast, strPassword, "", "Created By ClearView on " + DateTime.Today.ToShortDateString() + Environment.NewLine + "Requested by " + oUser.GetFullName(intProfile) + " (" + oUser.GetName(intProfile) + ")", oVariable.UserOUTechnical());
                                    if (strResult == "")
                                    {
                                        strResult = "<p>The account " + strUser + " was successfully created in " + oDomain.Get(intDomain, "name") + " with registry access (Password: "******")</p>";
                                    }
                                }
                                else
                                {
                                    strResult = oAD.CreateUser(strUser, strFirst, strLast, strPassword, "", "Created By ClearView on " + DateTime.Today.ToShortDateString() + Environment.NewLine + "Requested by " + oUser.GetFullName(intProfile) + " (" + oUser.GetName(intProfile) + ")", oVariable.UserOU());
                                    if (strResult == "")
                                    {
                                        strResult = "<p>The account " + strUser + " was successfully created in " + oDomain.Get(intDomain, "name") + " (Password: "******")</p>";
                                    }
                                }
                                string   strGroupsRequested = dsParameters.Tables[0].Rows[5]["value"].ToString();
                                string[] strGroupRequested;
                                char[]   strSplit = { ';' };
                                strGroupRequested = strGroupsRequested.Split(strSplit);
                                // Add Groups
                                for (int ii = 0; ii < strGroupRequested.Length; ii++)
                                {
                                    if (strGroupRequested[ii].Trim() != "")
                                    {
                                        // Add the group
                                        string strJoin = oAD.JoinGroup(strUser, strGroupRequested[ii].Trim(), 0);
                                        if (strJoin == "")
                                        {
                                            strResult += "<p>The user " + strUser + " was successfully joined to the group " + strGroupRequested[ii].Trim() + "</p>";
                                        }
                                        else
                                        {
                                            strError += "<p>The user " + strUser + " was NOT successfully joined to the group " + strGroupRequested[ii].Trim() + " : " + strJoin + "</p>";
                                        }
                                    }
                                }
                                oRequest.AddResult(intRequest, intItem, intNumber, "Account Modification", strError, strResult, intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                            }
                        }
                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_error.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td valign=\"top\"><img src=\"/images/ico_check.gif\" border=\"0\" align=\"absmiddle\"/></td><td valign=\"top\" class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
Example #26
0
        private bool LoadInformation(int _request_workflow)
        {
            if (intProject > 0)
            {
                lblName.Text   = oProject.Get(intProject, "name");
                lblNumber.Text = oProject.Get(intProject, "number");
                lblType.Text   = "Project";
            }
            else
            {
                lblName.Text   = oResourceRequest.GetWorkflow(_request_workflow, "name");
                lblNumber.Text = "CVT" + intRequest.ToString();
                lblType.Text   = "Task";
            }
            bool    boolDone = false;
            DataSet ds       = oOnDemandTasks.GetVMWareII(intRequest, intItem, intNumber);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Forecast oForecast = new Forecast(intProfile, dsn);
                int      intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                if (oForecast.IsHARoom(intAnswer) == true)
                {
                    DataSet dsServer = oServer.GetAnswer(intAnswer);
                    foreach (DataRow drServer in dsServer.Tables[0].Rows)
                    {
                        int     intHA = Int32.Parse(drServer["id"].ToString());
                        DataSet dsHA  = oServer.GetHA(intHA);
                        if (dsHA.Tables[0].Rows.Count > 0)
                        {
                            if (lblHA.Text != "")
                            {
                                lblHA.Text += "<br/>";
                            }
                            lblHA.Text   += oServer.GetName(intHA, true) + " = " + oServer.GetName(Int32.Parse(dsHA.Tables[0].Rows[0]["serverid_ha"].ToString()), true);
                            panHA.Visible = true;
                        }
                    }
                }
                lblAnswer.Text = intAnswer.ToString();
                btnView.Attributes.Add("onclick", "return OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');");
                btnBirth.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                btnSC.Attributes.Add("onclick", "return OpenWindow('PDF_BIRTH','?id=" + intAnswer.ToString() + "');");
                lblView.Text = oOnDemandTasks.GetBody(intAnswer, intImplementorDistributed, intImplementorMidrange);
                int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                Models oModel     = new Models(intProfile, dsn);
                int    intType    = Int32.Parse(oModel.Get(intModel, "typeid"));
                Types  oType      = new Types(intProfile, dsn);
                string strExecute = oType.Get(intType, "forecast_execution_path");
                if (strExecute != "")
                {
                    btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                }
                chk1.Checked  = (ds.Tables[0].Rows[0]["chk1"].ToString() == "1");
                chk3.Checked  = (ds.Tables[0].Rows[0]["chk3"].ToString() == "1");
                chk4.Checked  = (ds.Tables[0].Rows[0]["chk4"].ToString() == "1");
                chk5.Checked  = (ds.Tables[0].Rows[0]["chk5"].ToString() == "1");
                chk6.Checked  = (ds.Tables[0].Rows[0]["chk6"].ToString() == "1");
                chk7.Checked  = (ds.Tables[0].Rows[0]["chk7"].ToString() == "1");
                chk8.Checked  = (ds.Tables[0].Rows[0]["chk8"].ToString() == "1");
                chk9.Checked  = (ds.Tables[0].Rows[0]["chk9"].ToString() == "1");
                chk10.Checked = (ds.Tables[0].Rows[0]["chk10"].ToString() == "1");
                chk11.Checked = (ds.Tables[0].Rows[0]["chk11"].ToString() == "1");
                int intNotifications = Int32.Parse(ds.Tables[0].Rows[0]["notifications"].ToString());
                int intClass         = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));

                if (oClass.Get(intClass, "prod") != "1")
                {
                    chk9.Checked   = true;
                    img9.ImageUrl  = "/images/cancel.gif";
                    chk10.Checked  = true;
                    img10.ImageUrl = "/images/cancel.gif";
                    chk11.Checked  = true;
                    img11.ImageUrl = "/images/cancel.gif";
                }
                boolDone = (chk1.Checked && chk3.Checked && chk4.Checked && chk5.Checked && chk6.Checked && chk7.Checked && chk8.Checked && chk9.Checked && chk10.Checked && chk11.Checked);

                img1.ImageUrl = "/images/green_arrow.gif";
                if (chk1.Checked == true)
                {
                    btnExecute.Enabled = false;
                    img1.ImageUrl      = "/images/check.gif";
                    img3.ImageUrl      = "/images/green_arrow.gif";
                    chk3.Enabled       = true;
                    Servers oServer  = new Servers(intProfile, dsn);
                    DataSet dsAnswer = oServer.GetAnswer(intAnswer);
                    foreach (DataRow drAnswer in dsAnswer.Tables[0].Rows)
                    {
                        if (lbl1.Text != "")
                        {
                            lbl1.Text += "<br/>";
                        }
                        int        intServer     = Int32.Parse(drAnswer["id"].ToString());
                        int        intServerName = Int32.Parse(drAnswer["nameid"].ToString());
                        ServerName oServerName   = new ServerName(0, dsn);
                        string     strName       = oServer.GetName(intServer, boolUsePNCNaming);
                        lbl1.Text += "Server Name: " + strName + "<br/>";
                        Zeus    oZeus  = new Zeus(intProfile, dsnZeus);
                        DataSet dsZeus = oZeus.GetBuildServer(intServer);
                        if (dsZeus.Tables[0].Rows.Count > 0)
                        {
                            lbl1.Text += "Serial Number: " + dsZeus.Tables[0].Rows[0]["serial"].ToString() + "<br/>";
                            lbl1.Text += "Asset Tag: " + dsZeus.Tables[0].Rows[0]["asset"].ToString() + "<br/>";
                        }
                        int     intDomain = Int32.Parse(drAnswer["domainid"].ToString());
                        Domains oDomain   = new Domains(intProfile, dsn);
                        boolMove = (oDomain.Get(intDomain, "move") == "1");
                        if (boolMove == true)
                        {
                            lbl1.Text += "DHCP Address: " + drAnswer["dhcp"].ToString() + "<br/>";
                        }
                        int         intIPAddress = 0;
                        IPAddresses oIPAddresses = new IPAddresses(0, dsnIP, dsn);
                        lbl1.Text += "Assigned IP Address: " + oServer.GetIPs(intServer, 1, 0, 0, dsnIP, "", "") + "<br/>";
                        lbl1.Text += "Final IP Address: " + oServer.GetIPs(intServer, 0, 1, 0, dsnIP, "", "") + "<br/>";
                        Asset  oAsset   = new Asset(intProfile, dsnAsset);
                        VMWare oVMWare  = new VMWare(intProfile, dsn);
                        int    intAsset = 0;
                        if (drAnswer["assetid"].ToString() != "")
                        {
                            intAsset = Int32.Parse(drAnswer["assetid"].ToString());
                        }
                        if (intAsset > 0)
                        {
                            DataSet dsGuest = oVMWare.GetGuest(strName);
                            if (dsGuest.Tables[0].Rows.Count > 0)
                            {
                                int intHost       = Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString());
                                int intCluster    = Int32.Parse(oVMWare.GetHost(intHost, "clusterid"));
                                int intFolder     = Int32.Parse(oVMWare.GetCluster(intCluster, "folderid"));
                                int intDataCenter = Int32.Parse(oVMWare.GetFolder(intFolder, "datacenterid"));
                                lbl1.Text += "DataCenter: " + oVMWare.GetDatacenter(intDataCenter, "name") + "<br/>";
                                lbl1.Text += "Host: " + oVMWare.GetHost(intHost, "name") + "<br/>";
                                int intDatastore = Int32.Parse(dsGuest.Tables[0].Rows[0]["datastoreid"].ToString());
                                lbl1.Text += "DataStore: " + oVMWare.GetDatastore(intDatastore, "name") + "<br/>";
                                int intPool = Int32.Parse(dsGuest.Tables[0].Rows[0]["poolid"].ToString());
                                //lbl1.Text += "Pool: " + oVMWare.GetPool(intPool, "name") + "<br/>";
                                int intVlan = Int32.Parse(dsGuest.Tables[0].Rows[0]["vlanid"].ToString());
                                lbl1.Text += "VLAN: " + oVMWare.GetVlan(intVlan, "name") + "<br/>";
                            }
                        }
                        Storage       oStorage      = new Storage(intProfile, dsn);
                        int           intCluster2   = Int32.Parse(drAnswer["clusterid"].ToString());
                        int           intCSMConfig2 = Int32.Parse(drAnswer["csmconfigid"].ToString());
                        int           intNumber2    = Int32.Parse(drAnswer["number"].ToString());
                        DataSet       dsLuns        = oStorage.GetLuns(intAnswer, 0, intCluster2, intCSMConfig2, intNumber2);
                        StringBuilder sbStorage     = new StringBuilder();
                        int           intRow        = 0;
                        bool          boolOverride  = (oForecast.GetAnswer(intAnswer, "storage_override") == "1");
                        foreach (DataRow drLun in dsLuns.Tables[0].Rows)
                        {
                            intRow++;
                            sbStorage.Append("<tr>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(intRow.ToString());
                            sbStorage.Append("</td>");
                            string strLetter = drLun["letter"].ToString();
                            if (strLetter == "")
                            {
                                if (drLun["driveid"].ToString() == "-1000")
                                {
                                    strLetter = "E";
                                }
                                else if (drLun["driveid"].ToString() == "-100")
                                {
                                    strLetter = "F";
                                }
                                else if (drLun["driveid"].ToString() == "-10")
                                {
                                    strLetter = "P";
                                }
                                else if (drLun["driveid"].ToString() == "-1")
                                {
                                    strLetter = "Q";
                                }
                            }
                            if ((boolOverride == true && drLun["driveid"].ToString() == "0") || oForecast.IsOSMidrange(intAnswer) == true)
                            {
                                sbStorage.Append("<td>");
                                sbStorage.Append(drLun["path"].ToString());
                                sbStorage.Append("</td>");
                            }
                            else
                            {
                                sbStorage.Append("<td>");
                                sbStorage.Append(strLetter);
                                sbStorage.Append(":");
                                sbStorage.Append(drLun["path"].ToString());
                                sbStorage.Append("</td>");
                            }
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["performance"].ToString());
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["size"].ToString());
                            sbStorage.Append(" GB</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_size"].ToString() == "-1" ? "Pending" : drLun["actual_size"].ToString() + " GB");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["size_qa"].ToString());
                            sbStorage.Append(" GB</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_size_qa"].ToString() == "-1" ? "Pending" : drLun["actual_size_qa"].ToString() + " GB");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["size_test"].ToString());
                            sbStorage.Append(" GB</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_size_test"].ToString() == "-1" ? "Pending" : drLun["actual_size_test"].ToString() + " GB");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["replicated"].ToString() == "0" ? "No" : "Yes");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_replicated"].ToString() == "-1" ? "Pending" : (drLun["actual_replicated"].ToString() == "0" ? "No" : "Yes"));
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td>");
                            sbStorage.Append(drLun["high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["size"].ToString() + " GB)");
                            sbStorage.Append("</td>");
                            sbStorage.Append("<td class=\"required\">");
                            sbStorage.Append(drLun["actual_high_availability"].ToString() == "-1" ? "Pending" : (drLun["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drLun["actual_size"].ToString() + " GB)"));
                            sbStorage.Append("</td>");
                            sbStorage.Append("</tr>");
                            DataSet dsPoints = oStorage.GetMountPoints(Int32.Parse(drLun["id"].ToString()));
                            int     intPoint = 0;
                            foreach (DataRow drPoint in dsPoints.Tables[0].Rows)
                            {
                                intRow++;
                                intPoint++;
                                sbStorage.Append("<tr>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(intRow.ToString());
                                sbStorage.Append("</td>");
                                if (oForecast.IsOSMidrange(intAnswer) == true)
                                {
                                    sbStorage.Append("<td>");
                                    sbStorage.Append(drPoint["path"].ToString());
                                    sbStorage.Append("</td>");
                                }
                                else
                                {
                                    sbStorage.Append("<td>");
                                    sbStorage.Append(strLetter);
                                    sbStorage.Append(":\\SH");
                                    sbStorage.Append(drLun["driveid"].ToString());
                                    sbStorage.Append("VOL");
                                    sbStorage.Append(intPoint < 10 ? "0" : "");
                                    sbStorage.Append(intPoint.ToString());
                                    sbStorage.Append("</td>");
                                }
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["performance"].ToString());
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["size"].ToString());
                                sbStorage.Append(" GB</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_size"].ToString() == "-1" ? "Pending" : drPoint["actual_size"].ToString() + " GB");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["size_qa"].ToString());
                                sbStorage.Append(" GB</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_size_qa"].ToString() == "-1" ? "Pending" : drPoint["actual_size_qa"].ToString() + " GB");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["size_test"].ToString());
                                sbStorage.Append(" GB</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_size_test"].ToString() == "-1" ? "Pending" : drPoint["actual_size_test"].ToString() + " GB");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["replicated"].ToString() == "0" ? "No" : "Yes");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_replicated"].ToString() == "-1" ? "Pending" : (drPoint["actual_replicated"].ToString() == "0" ? "No" : "Yes"));
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td>");
                                sbStorage.Append(drPoint["high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["size"].ToString() + " GB)");
                                sbStorage.Append("</td>");
                                sbStorage.Append("<td class=\"required\">");
                                sbStorage.Append(drPoint["actual_high_availability"].ToString() == "-1" ? "Pending" : (drPoint["actual_high_availability"].ToString() == "0" ? "No" : "Yes (" + drPoint["actual_size"].ToString() + " GB)"));
                                sbStorage.Append("</td>");
                                sbStorage.Append("</tr>");
                            }
                        }
                        if (sbStorage.ToString() != "")
                        {
                            sbStorage.Insert(0, "<tr class=\"bold\"><td></td><td>Path</td><td>Performance</td><td>Requested<br/>Size in Prod</td><td>Actual<br/>Size in Prod</td><td>Requested<br/>Size in QA</td><td>Actual<br/>Size in QA</td><td>Requested<br/>Size in Test</td><td>Actual<br/>Size in Test</td><td>Requested<br/>Replication</td><td>Actual<br/>Replication</td><td>Requested<br/>High Availability</td><td>Actual<br/>High Availability</td></tr>");
                            sbStorage.Insert(0, "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">");
                            sbStorage.Append("</table>");
                        }
                        lbl1.Text += sbStorage.ToString();
                    }
                }
                if (chk3.Checked == true)
                {
                    img3.ImageUrl = "/images/check.gif";
                    img4.ImageUrl = "/images/green_arrow.gif";
                    chk4.Enabled  = true;
                }
                if (chk4.Checked == true)
                {
                    img4.ImageUrl = "/images/check.gif";
                    if (boolMove == true)
                    {
                        img5.ImageUrl = "/images/green_arrow.gif";
                        chk5.Enabled  = true;
                    }
                    else
                    {
                        chk5.Checked  = true;
                        img7.ImageUrl = "/images/green_arrow.gif";
                        chk7.Enabled  = true;
                    }
                }
                if (chk5.Checked == true)
                {
                    if (boolMove == true)
                    {
                        img5.ImageUrl = "/images/check.gif";
                    }
                    else
                    {
                        img5.ImageUrl = "/images/cancel.gif";
                    }
                    if (boolMove == true)
                    {
                        img6.ImageUrl = "/images/green_arrow.gif";
                        chk6.Enabled  = true;
                    }
                }
                if (chk6.Checked == true)
                {
                    if (boolMove == true)
                    {
                        img6.ImageUrl = "/images/check.gif";
                    }
                    else
                    {
                        img6.ImageUrl = "/images/cancel.gif";
                    }
                    if (boolMove == true)
                    {
                        img7.ImageUrl = "/images/green_arrow.gif";
                        chk7.Enabled  = true;
                    }
                }
                if (chk7.Checked == true)
                {
                    img7.ImageUrl = "/images/check.gif";
                    img8.ImageUrl = "/images/green_arrow.gif";
                    chk8.Enabled  = true;
                }
                if (chk8.Checked == true)
                {
                    img8.ImageUrl = "/images/check.gif";
                    img9.ImageUrl = "/images/green_arrow.gif";
                    chk9.Enabled  = true;
                }
                if (chk9.Checked == true)
                {
                    img9.ImageUrl  = "/images/check.gif";
                    img10.ImageUrl = "/images/green_arrow.gif";
                    chk10.Enabled  = true;
                }
                if (chk10.Checked == true)
                {
                    img10.ImageUrl = "/images/check.gif";
                    img11.ImageUrl = "/images/green_arrow.gif";
                    chk11.Enabled  = true;
                }
                if (chk11.Checked == true)
                {
                    img11.ImageUrl = "/images/check.gif";
                }
            }
            if (Request.QueryString["div"] != null)
            {
                switch (Request.QueryString["div"])
                {
                case "E":
                    boolExecution = true;
                    break;
                }
            }
            if (boolDetails == false && boolExecution == false)
            {
                boolDetails = true;
            }
            return(boolDone);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(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 **************
                        AccountRequest oAccountRequest = new AccountRequest(intProfile, dsn);
                        Requests       oRequest        = new Requests(intProfile, dsn);
                        Users          oUser           = new Users(intProfile, dsn);
                        DataSet        ds      = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                        Domains        oDomain = new Domains(intProfile, dsn);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string         strUser   = ds.Tables[0].Rows[0]["username"].ToString();
                            int            intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                            int            intEnv    = Int32.Parse(oDomain.Get(intDomain, "environment"));
                            int            intUser   = oRequest.GetUser(intRequest);
                            AD             oAD       = new AD(intProfile, dsn, intEnv);
                            DirectoryEntry oEntry    = oAD.UserSearch(strUser);
                            if (oEntry == null)
                            {
                                strResult = "";
                            }
                            else
                            {
                                if (oAD.IsLocked(oEntry) == true)
                                {
                                    strResult = oAD.Unlock(oEntry);
                                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Unlock", strResult, "Account " + strUser + " was successfully unlocked", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                                    if (strResult == "")
                                    {
                                        strResult = "<p>Account " + strUser + " was unlocked</p>";
                                    }
                                }
                                else
                                {
                                    oRequest.AddResult(intRequest, intItem, intNumber, "Account Unlock", "", "Account " + strUser + " was not locked", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                                    strResult = "<p>Account " + strUser + " was not locked</p>";
                                }
                            }
                        }
                        if (strResult == "")
                        {
                            boolSuccess = false;
                        }
                        // ******** END PROCESSING **************
                        if (oService.Get(intService, "automate") == "1" && boolSuccess == true)
                        {
                            strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + strResult + "</td></tr></table>";
                        }
                        else
                        {
                            if (boolSuccess == false)
                            {
                                strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + strError + "</td></tr></table>";
                            }
                            else
                            {
                                strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                            }
                        }
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
Example #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Servers          oServer           = new Servers(0, dsn);
            VMWare           oVMWare           = new VMWare(0, dsn);
            Forecast         oForecast         = new Forecast(0, dsn);
            Environments     oEnvironment      = new Environments(0, dsn);
            OperatingSystems oOperatingSystem  = new OperatingSystems(0, dsn);
            Classes          oClass            = new Classes(0, dsn);
            Requests         oRequest          = new Requests(0, dsn);
            Projects         oProject          = new Projects(0, dsn);
            ServerName       oServerName       = new ServerName(0, dsn);
            Locations        oLocations        = new Locations(0, dsn);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
            ServicePacks     oServicePacks     = new ServicePacks(0, dsn);
            Users            oUser             = new Users(0, dsn);
            Organizations    oOrganization     = new Organizations(0, dsn);
            IPAddresses      oIPAddresses      = new IPAddresses(0, dsnIP, dsn);
            ResourceRequest  oResourceRequest  = new ResourceRequest(0, dsn);
            Domains          oDomains          = new Domains(0, dsn);

            oVariables = new Variables(intEnvironment);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                StringBuilder sbTable   = new StringBuilder(strTable);
                int           intServer = Int32.Parse(Request.QueryString["id"]);
                DataSet       ds        = oServer.Get(intServer);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int    intAnswer   = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    int    intName     = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString());
                    string strName     = oServer.GetName(intServer, boolUsePNCNaming);
                    int    intForecast = Int32.Parse(oForecast.GetAnswer(intAnswer, "forecastid"));
                    int    intRequest  = Int32.Parse(oForecast.Get(intForecast, "requestid"));
                    int    intProject  = oRequest.GetProjectNumber(intRequest);
                    int    intClass    = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid"));
                    int    intEnv      = Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid"));
                    int    intModel    = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());

                    string _save_location = oVariables.UploadsFolder() + "SC\\";
                    string strFileName    = "SC_" + intServer.ToString() + "_" + oProject.Get(intProject, "number") + ".HTM";
                    if (Directory.Exists(_save_location) == false)
                    {
                        Directory.CreateDirectory(_save_location);
                    }
                    string       strFile = _save_location + strFileName;
                    StreamWriter fp      = File.CreateText(strFile);


                    string strDefault = "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">";

                    StringBuilder sbLeft1 = new StringBuilder();
                    string        strLead = oProject.Get(intProject, "lead");
                    int           intLead = 0;
                    if (strLead != "")
                    {
                        intLead = Int32.Parse(strLead);
                    }
                    sbLeft1.Append("<fieldset>");
                    sbLeft1.Append("<legend><b>Who is this for?</b></legend>");
                    sbLeft1.Append(strDefault);
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client XID:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Name:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Phone No.:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Department:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox("", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Fax:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox("", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("<tr>");
                    sbLeft1.Append("<td>Client Cost Center:</td>");
                    sbLeft1.Append("<td>");
                    sbLeft1.Append(GetBox("", 200));
                    sbLeft1.Append("</td>");
                    sbLeft1.Append("</tr>");
                    sbLeft1.Append("</table>");
                    sbLeft1.Append("</fieldset>");

                    StringBuilder sbRight1 = new StringBuilder();
                    string        strIE    = oProject.Get(intProject, "engineer");
                    int           intIE    = 0;
                    if (strIE != "")
                    {
                        intIE = Int32.Parse(strIE);
                    }
                    sbRight1.Append("<fieldset>");
                    sbRight1.Append("<legend><b>Requestor Information</b></legend>");
                    sbRight1.Append(strDefault);
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Requested By Name:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox(intIE > 0 ? oUser.GetFullName(intIE) : "***ERROR**", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Requested By Phone No.:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox(intIE > 0 ? oUser.Get(intIE, "phone") : "***ERROR**", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Requested By Email:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox(intIE > 0 ? oUser.GetEmail(oUser.GetName(intIE), intEnvironment) : "***ERROR**", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("</table>");
                    sbRight1.Append("</fieldset>");
                    sbRight1.Append("<fieldset>");
                    sbRight1.Append("<legend><b>Location Information:</b></legend>");
                    sbRight1.Append(strDefault);
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Location:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox("", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("<tr>");
                    sbRight1.Append("<td>Location Full Name:</td>");
                    sbRight1.Append("<td>");
                    sbRight1.Append(GetBox("", 200));
                    sbRight1.Append("</td>");
                    sbRight1.Append("</tr>");
                    sbRight1.Append("</table>");
                    sbRight1.Append("</fieldset>");

                    StringBuilder sbCenter1 = new StringBuilder();
                    sbCenter1.Append("<fieldset>");
                    sbCenter1.Append("<legend><b>Brief Desc:</b></legend>");
                    sbCenter1.Append(strDefault);
                    sbCenter1.Append("<tr>");
                    sbCenter1.Append("<td>");
                    sbCenter1.Append(GetBox(oForecast.GetAnswer(intAnswer, "name") + " (" + strName + ")", 600));
                    sbCenter1.Append("</td>");
                    sbCenter1.Append("</tr>");
                    sbCenter1.Append("</table>");
                    sbCenter1.Append("</fieldset>");

                    StringBuilder sbLeft2 = new StringBuilder();
                    sbLeft2.Append("<fieldset>");
                    sbLeft2.Append("<legend><b>Project Information:</b></legend>");
                    sbLeft2.Append(strDefault);
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project ID:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(oProject.Get(intProject, "number"), 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager XID:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetName(intLead) : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project Name:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(oProject.Get(intProject, "name"), 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager Name:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetFullName(intLead) : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project Budgeted:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(oProject.Get(intProject, "bd"), 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager Phone:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.Get(intLead, "phone") : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("<tr>");
                    sbLeft2.Append("<td>Project Cost Ctr:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox("", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("<td>Project Manager Email:</td>");
                    sbLeft2.Append("<td>");
                    sbLeft2.Append(GetBox(intLead > 0 ? oUser.GetEmail(oUser.GetName(intLead), intEnvironment) : "***ERROR**", 200));
                    sbLeft2.Append("</td>");
                    sbLeft2.Append("</tr>");
                    sbLeft2.Append("</table>");
                    sbLeft2.Append("</fieldset>");

                    OnDemandTasks oOnDemandTasks = new OnDemandTasks(0, dsn);
                    int           intImplementor = 0;
                    DataSet       dsTasks        = oOnDemandTasks.GetPending(intAnswer);
                    if (dsTasks.Tables[0].Rows.Count > 0)
                    {
                        intImplementor = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intImplementor, "userid"));
                    }
                    else
                    {
                        intImplementor = -999;
                    }
                    sbTable = new StringBuilder("<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" class=\"default\">");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\"><b>NOTE:</b> ASSIGN THIS REQUEST TO: ");
                    sbTable.Append(intImplementor > 0 || intImplementor == -999 ? oUser.GetFullName(intImplementor) + " (" + oUser.GetName(intImplementor) + ")" : "***ERROR**");
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td>");
                    sbTable.Append(sbLeft1.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("<td>");
                    sbTable.Append(sbRight1.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\">");
                    sbTable.Append(sbCenter1.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\">");
                    sbTable.Append(sbLeft2.ToString());
                    sbTable.Append("</td>");
                    sbTable.Append("</tr>");
                    sbTable.Append("<tr>");
                    sbTable.Append("<td colspan=\"2\"><p>&nbsp;</p></td>");
                    sbTable.Append("</tr>");

                    bool boolVirtual = false;
                    if (boolVirtual == true)
                    {
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION VIRTUAL SERVER GUEST</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Requested Server Completion Date:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Hardware Specifications:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("VIRTUAL SERVER GUEST VMWARE", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Operating System:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Environment:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Class:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Domain:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Backup Method:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TSM", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        string  strHost = "***ERROR***";
                        DataSet dsGuest = oVMWare.GetGuest(strName);
                        if (dsGuest.Tables[0].Rows.Count > 0)
                        {
                            strHost = oVMWare.GetHost(Int32.Parse(dsGuest.Tables[0].Rows[0]["hostid"].ToString()), "name").ToUpper();
                        }
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Host Server Name:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(strHost, 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>");
                        sbTable.Append("</tr>");
                        bool    boolSQL = false;
                        bool    boolIIS = false;
                        DataSet dsComp  = oServerName.GetComponentDetailSelected(intServer, 1);
                        foreach (DataRow drComp in dsComp.Tables[0].Rows)
                        {
                            if (drComp["code"].ToString() == "IIS")
                            {
                                boolIIS = true;
                            }
                            if (drComp["code"].ToString() == "SQL")
                            {
                                boolSQL = true;
                            }
                        }
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TCP/IP", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Attached to SAN?:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server is Clustered:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Load Balanced:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Maximum Allowable Downtime:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("Not Applicable", 150) + "</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">");
                        sbTable.Append(GetBox("", 500));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                    }
                    else
                    {
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\" class=\"header\">REQUISITION SERVER</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Requested Server Completion Date:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oForecast.GetAnswer(intAnswer, "implementation"), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Hardware Specifications:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oModelsProperties.Get(intModel, "name"), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\" checked/> User re-deployable hardware if applicable</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>PO:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Operating System:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oOperatingSystem.Get(Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()), "name").ToUpper() + " (" + oServicePacks.Get(Int32.Parse(ds.Tables[0].Rows[0]["spid"].ToString()), "name").ToUpper() + ")", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Environment:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oEnvironment.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "environmentid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Class:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oClass.Get(Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Destination Domain:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oDomains.Get(Int32.Parse(ds.Tables[0].Rows[0]["domainid"].ToString()), "name").ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Location:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox(oLocations.GetFull(Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid"))).ToUpper(), 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Backup Method:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TSM", 300));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Network Protocols</td>");
                        sbTable.Append("<td bgcolor=\"#CCCCCC\" style=\"border:2px outset #FFFFFF\">Server Software - click in box below to add</td>");
                        sbTable.Append("</tr>");
                        bool    boolSQL = false;
                        bool    boolIIS = false;
                        DataSet dsComp  = oServerName.GetComponentDetailSelected(intServer, 1);
                        foreach (DataRow drComp in dsComp.Tables[0].Rows)
                        {
                            if (drComp["code"].ToString() == "IIS")
                            {
                                boolIIS = true;
                            }
                            if (drComp["code"].ToString() == "SQL")
                            {
                                boolSQL = true;
                            }
                        }
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("TCP/IP", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolSQL ? "SQL" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("", 250));
                        sbTable.Append("</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox((boolIIS ? "IIS" : ""), 350));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Attached to SAN?:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server is Clustered:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Server Load Balanced:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("NO", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td>Maximum Allowable Downtime:</td>");
                        sbTable.Append("<td>");
                        sbTable.Append(GetBox("Not Applicable", 150));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\"><input type=\"checkbox\" class=\"default\"/> Hardware Refresh</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr><td colspan=\"2\"><p>&nbsp;</p></td></tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">Intended Use Description:</td>");
                        sbTable.Append("</tr>");
                        sbTable.Append("<tr>");
                        sbTable.Append("<td colspan=\"2\">");
                        sbTable.Append(GetBox("", 500));
                        sbTable.Append("</td>");
                        sbTable.Append("</tr>");
                    }
                    sbTable.Append("</table>");

                    fp.WriteLine("<html>");
                    fp.WriteLine("<head>");
                    fp.WriteLine("<title>ClearView | Service Center Request Form</title>");
                    fp.WriteLine("<style type=\"text/css\">");
                    fp.WriteLine(".default {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;}");
                    fp.WriteLine(".header {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 16px;font-style: italic;font-weight: bold;}");
                    fp.WriteLine("</style>");
                    fp.WriteLine("<body leftmargin=\"0\" topmargin=\"0\">");
                    fp.WriteLine(sbTable.ToString());
                    fp.WriteLine("</body>");
                    fp.WriteLine("</html>");
                    fp.Close();
                }

                strTable = sbTable.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            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);
            oApplication     = new Applications(intProfile, dsn);
            oAccountRequest  = new AccountRequest(intProfile, dsn);
            oDelegate        = new Delegates(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);
            }
            string strAttributes  = "";
            bool   boolIncomplete = false;

            if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]);
                int     intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
                DataSet ds = oResourceRequest.Get(intResourceParent);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                    intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                    // Workflow start
                    bool   boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3");
                    int    intUser      = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                    double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                    // Workflow end
                    intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                    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 (oService.Get(intService, "sla") != "")
                    {
                        oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");
                        int intDays = oResourceRequest.GetSLA(intResourceParent);
                        if (intDays < 1)
                        {
                            btnSLA.Style["border"] = "solid 2px #FF0000";
                        }
                        else if (intDays < 3)
                        {
                            btnSLA.Style["border"] = "solid 2px #FF9999";
                        }
                        btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');");
                    }
                    else
                    {
                        btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                        btnSLA.Enabled  = false;
                    }
                    if (!IsPostBack)
                    {
                        if (intResourceWorkflow > 0)
                        {
                            ds = oRequest.Get(intRequest);
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                ds = oAccountRequest.GetMaintenance(intRequest, intItem, intNumber);
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    if (ds.Tables[0].Rows[0]["completed"].ToString() == "")
                                    {
                                        boolIncomplete = true;
                                    }
                                    else
                                    {
                                        lblComplete.Text    = ds.Tables[0].Rows[0]["completed"].ToString();
                                        panComplete.Visible = true;
                                    }
                                    lblRequestBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest));
                                    lblRequestOn.Text = DateTime.Parse(oRequest.Get(intRequest, "created")).ToLongDateString();
                                    int     intDomain = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
                                    Domains oDomain   = new Domains(intProfile, dsn);
                                    intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
                                    AD      oAD          = new AD(intProfile, dsn, intDomain);
                                    DataSet dsParameters = oAccountRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
                                    switch (ds.Tables[0].Rows[0]["maintenance"].ToString())
                                    {
                                    case "DISABLE":
                                        lblType.Text = "Account Disable";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "UNLOCK":
                                        lblType.Text = "Account Unlock";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "ENABLE":
                                        lblType.Text = "Account Enable";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "EMAIL":
                                        lblType.Text = "Email Enable an Account";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "MOVE":
                                        lblType.Text = "Account Move";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        strDetails  += "<tr><td><b>New Location:</b></td><td>" + dsParameters.Tables[0].Rows[0]["value"].ToString() + "</td>";
                                        break;

                                    case "PASSWORD":
                                        lblType.Text = "Account Password Change";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "COPY":
                                        lblType.Text        = "Account Copy";
                                        panPassword.Visible = true;
                                        strAttributes      += "ValidateText('" + txtPassword.ClientID + "','Please enter a password') && ";
                                        strDetails         += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails         += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        panID.Visible       = true;
                                        txtID.Text          = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                        panFirst.Visible    = true;
                                        txtFirst.Text       = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                        panLast.Visible     = true;
                                        txtLast.Text        = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                        panGroups.Visible   = true;
                                        string[] strGroups;
                                        char[]   strSplit = { ';' };
                                        strGroups = dsParameters.Tables[0].Rows[3]["value"].ToString().Split(strSplit);
                                        for (int ii = 0; ii < strGroups.Length; ii++)
                                        {
                                            if (strGroups[ii].Trim() != "")
                                            {
                                                ListItem oList = new ListItem(strGroups[ii].Trim());
                                                chkGroups.Items.Add(oList);
                                                oList.Selected = true;
                                            }
                                        }
                                        break;

                                    case "DELETE":
                                        lblType.Text = "Account Deletion";
                                        strDetails  += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails  += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        break;

                                    case "RENAME":
                                        lblType.Text     = "Account Rename";
                                        strDetails      += "<tr><td><b>Account:</b></td><td>" + ds.Tables[0].Rows[0]["username"].ToString() + " (" + oAD.GetUserFullName(ds.Tables[0].Rows[0]["username"].ToString()) + ")</td>";
                                        strDetails      += "<tr><td><b>Domain:</b></td><td>" + oDomain.Get(Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString()), "name") + "</td>";
                                        panID.Visible    = true;
                                        txtID.Text       = dsParameters.Tables[0].Rows[0]["value"].ToString();
                                        panFirst.Visible = true;
                                        txtFirst.Text    = dsParameters.Tables[0].Rows[1]["value"].ToString();
                                        panLast.Visible  = true;
                                        txtLast.Text     = dsParameters.Tables[0].Rows[2]["value"].ToString();
                                        break;

                                    default:
                                        lblType.Text = "Unavailable";
                                        strDetails  += "<tr><td colspan=\"2\"><b>Invalid Maintenance Code!</b></td>";
                                        break;
                                    }
                                    panWorkload.Visible = true;
                                }
                                else
                                {
                                    panDenied.Visible = true;
                                }
                            }
                            else
                            {
                                panDenied.Visible = true;
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }

                        btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                        oFunction.ConfigureToolButton(btnApprove, "/images/tool_approve");
                        oFunction.ConfigureToolButton(btnDeny, "/images/tool_deny");
                        if (boolIncomplete == true)
                        {
                            btnApprove.Attributes.Add("onclick", "return " + strAttributes + "confirm('Are you sure you want to APPROVE this request?');");
                            btnDeny.Attributes.Add("onclick", "return ValidateText('" + txtComments.ClientID + "','Please enter a reason') && confirm('Are you sure you want to DENY this request?');");
                        }
                        else
                        {
                            btnApprove.Attributes.Add("onclick", "alert('This request has already been completed.\\n\\nIf this request continues to appear in your work queue, please contact a ClearView administrator.');return false;");
                            btnDeny.Attributes.Add("onclick", "alert('This request has already been completed.\\n\\nIf this request continues to appear in your work queue, please contact a ClearView administrator.');return false;");
                        }
                        oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                        btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                        oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                        btnClose.Attributes.Add("onclick", "return ExitWindow();");
                        // 6/1/2009 - Load ReadOnly View
                        if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false)
                        {
                            oFunction.ConfigureToolButtonRO(btnApprove, btnDeny);
                            //panDenied.Visible = true;
                        }
                    }
                }
                else
                {
                    panDenied.Visible = true;
                }
            }
            else
            {
                panDenied.Visible = true;
            }
        }
        protected void btnApprove_Click(Object Sender, EventArgs e)
        {
            oResourceRequest.UpdateWorkflowHours(intResourceWorkflow);
            DataSet ds             = oGroupRequest.GetMaintenance(intRequest, intItem, intNumber);
            int     intUser        = oRequest.GetUser(intRequest);
            DataSet dsParameters   = oGroupRequest.GetMaintenanceParameters(intRequest, intItem, intNumber);
            string  strMaintenance = ds.Tables[0].Rows[0]["maintenance"].ToString();
            string  strGroup       = ds.Tables[0].Rows[0]["name"].ToString();
            int     intDomain      = Int32.Parse(ds.Tables[0].Rows[0]["domain"].ToString());
            Domains oDomain        = new Domains(intProfile, dsn);

            intDomain = Int32.Parse(oDomain.Get(intDomain, "environment"));
            AD             oAD       = new AD(intProfile, dsn, intDomain);
            Variables      oVariable = new Variables(intDomain);
            DirectoryEntry oEntry    = oAD.GroupSearch(strGroup);

            if (oEntry != null)
            {
                switch (strMaintenance)
                {
                case "MOVE":
                    // Group Move
                    string strPath = dsParameters.Tables[0].Rows[0]["value"].ToString();
                    oRequest.AddResult(intRequest, intItem, intNumber, "Group Move", oAD.MoveGroup(oEntry, strPath), "Group " + strGroup + " was successfully moved", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "COPY":
                    // Group Copy
                    string strID     = txtID.Text;
                    string strScope2 = dsParameters.Tables[0].Rows[1]["value"].ToString();
                    if (strScope2 == "Domain Local")
                    {
                        strScope2 = "DLG";
                    }
                    if (strScope2 == "Global")
                    {
                        strScope2 = "GG";
                    }
                    if (strScope2 == "Universal")
                    {
                        strScope2 = "UG";
                    }
                    string strType2 = dsParameters.Tables[0].Rows[2]["value"].ToString();
                    if (strType2 == "Security")
                    {
                        strType2 = "S";
                    }
                    if (strType2 == "Distribution")
                    {
                        strType2 = "D";
                    }
                    oRequest.AddResult(intRequest, intItem, intNumber, "Group Copy", oAD.CreateGroup(strID, "", "Created by ClearView - " + DateTime.Now.ToShortDateString(), oVariable.GroupOU(), strScope2, strType2), "Group " + strGroup + " was successfully copied", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    foreach (ListItem oList in chkUsers.Items)
                    {
                        if (oList.Selected == true)
                        {
                            oRequest.AddResult(intRequest, intItem, intNumber, "Group Membership", oAD.JoinGroup(oList.Value, strID, 0), "Account " + oList.Value + " was successfully added to the group " + strGroup, intEnvironment, (oService.Get(intService, "notify_client") == "1"), "");
                        }
                    }
                    break;

                case "DELETE":
                    // Group Deletion
                    oRequest.AddResult(intRequest, intItem, intNumber, "Group Deletion", oAD.Delete(oEntry), "Group " + strGroup + " was successfully deleted", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "RENAME":
                    // Group Rename
                    string strI = txtID.Text;
                    oRequest.AddResult(intRequest, intItem, intNumber, "Group Rename", oAD.Rename(oEntry, strI, "", ""), "Group " + strGroup + " was successfully renamed", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;

                case "CHANGE":
                    // Group Change
                    string strScope3 = dsParameters.Tables[0].Rows[0]["value"].ToString();
                    if (strScope3 == "Domain Local")
                    {
                        strScope3 = "DLG";
                    }
                    if (strScope3 == "Global")
                    {
                        strScope3 = "GG";
                    }
                    if (strScope3 == "Universal")
                    {
                        strScope3 = "UG";
                    }
                    string strType3 = dsParameters.Tables[0].Rows[1]["value"].ToString();
                    if (strType3 == "Security")
                    {
                        strType3 = "S";
                    }
                    if (strType3 == "Distribution")
                    {
                        strType3 = "D";
                    }
                    oRequest.AddResult(intRequest, intItem, intNumber, "Group Change", oAD.Change(oEntry, strScope3, strType3), "Group " + strGroup + " was successfully changed", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
                    break;
                }
            }
            else if (strMaintenance == "CREATE")
            {
                // Group Creation
                string strScope1 = dsParameters.Tables[0].Rows[0]["value"].ToString();
                if (strScope1 == "Domain Local")
                {
                    strScope1 = "DLG";
                }
                if (strScope1 == "Global")
                {
                    strScope1 = "GG";
                }
                if (strScope1 == "Universal")
                {
                    strScope1 = "UG";
                }
                string strType1 = dsParameters.Tables[0].Rows[1]["value"].ToString();
                if (strType1 == "Security")
                {
                    strType1 = "S";
                }
                if (strType1 == "Distribution")
                {
                    strType1 = "D";
                }
                oRequest.AddResult(intRequest, intItem, intNumber, "Group Creation", oAD.CreateGroup(txtID.Text, "", "Created by ClearView - " + DateTime.Now.ToShortDateString(), oVariable.GroupOU(), strScope1, strType1), "Group " + strGroup + " was successfully created", intEnvironment, (oService.Get(intService, "notify_client") == "1"), oUser.GetName(intUser));
            }
            oGroupRequest.UpdateMaintenance(intRequest, intItem, intNumber, 1, txtComments.Text);
            Complete();
        }