protected void btnAdd_Click(Object Sender, EventArgs e) { int intUser = Int32.Parse(Request.Form[hdnUser.UniqueID]); oWorkstation.AddAccountFix(intAsset, 0, intUser, (chkAdmin.Checked ? 1 : 0), (chkRemote.Checked ? 1 : 0)); Response.Redirect(Request.Path + "?id=" + Request.QueryString["id"] + "&add=true"); }
protected void btnNext_Click(Object Sender, EventArgs e) { int intRequest = Int32.Parse(Request.QueryString["rid"]); int intItem = Int32.Parse(lblItem.Text); int intNumber = Int32.Parse(lblNumber.Text); foreach (ListItem oList in lstWorkstations.Items) { if (oList.Selected == true) { int intWorkstation = Int32.Parse(oList.Value); DataSet dsWorkstation = oWorkstation.GetVirtual(intWorkstation); if (dsWorkstation.Tables[0].Rows.Count > 0) { oCustomized.AddVirtualWorkstationAccount(intRequest, intItem, intNumber, intWorkstation); oWorkstation.AddAccountFix(Int32.Parse(dsWorkstation.Tables[0].Rows[0]["assetid"].ToString()), 0, Int32.Parse(Request.Form[hdnManager.UniqueID]), 0, 1); } } } oRequestItem.UpdateForm(intRequest, true); Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString()); }
protected void btnAdd_Click(Object Sender, EventArgs e) { if (Request.QueryString["userid"] != null && Request.QueryString["userid"] != "") { lblError.Text = ""; int intUser = Int32.Parse(Request.QueryString["userid"]); AD oAD = new AD(0, dsn, (int)CurrentEnvironment.CORPDMN); string strXID = txtXID.Text.Trim().ToUpper(); SearchResultCollection oResults = oAD.Search(strXID, "sAMAccountName"); if (oResults.Count == 1) { SearchResult oResult = oResults[0]; if (oResult.Properties.Contains("sAMAccountName") == true) { strXID = oResult.GetDirectoryEntry().Properties["sAMAccountName"].Value.ToString(); } if (oResult.Properties.Contains("extensionattribute10") == true) { string strID = oUser.GetName(intUser, false); string strPNCID = oResult.GetDirectoryEntry().Properties["extensionattribute10"].Value.ToString(); if (strID.ToUpper().Trim() == strPNCID.Trim().ToUpper()) { oUser.Update(intUser, strXID, strID.ToUpper()); int intAdmin = Int32.Parse(Request.QueryString["admin"]); if (panAdmin.Visible == false) { intAdmin = 0; } oWorkstation.AddAccountFix(0, intWorkstation, intUser, intAdmin, Int32.Parse(Request.QueryString["remote"])); Response.Redirect(Request.Path + "?id=" + Request.QueryString["id"] + "&add=true"); } else { lblError.Text = "<p>The X-ID you entered (" + strXID + ") has a different PNC ID configured (" + strPNCID + ").</p><p>Please try again or contact your clearview administrator.</p>"; } } else { lblError.Text = "<p>The X-ID you entered (" + strXID + ") does not have a PNC ID attribute configured.</p><p>Please try again or contact your clearview administrator.</p>"; } } else if (oResults.Count > 1) { lblError.Text = "There were " + oResults.Count.ToString() + " accounts found in CORPDMN for the account " + txtXID.Text + ". Please try again."; } else { lblError.Text = "Could not find that X-ID in CORPDMN. Please try again."; } } else { int intUser = Int32.Parse(Request.Form[hdnUser.UniqueID]); bool boolContinue = false; string strID = oUser.GetName(intUser, false); string strXID = oUser.GetName(intUser, true); if (strXID == "" || strID == "" || strXID == strID) { // Get X-ID (since it is needed for the INI file and AD setup) SearchResultCollection oCollection = oFunction.eDirectory(strID); if (oCollection.Count == 1 && oCollection[0].GetDirectoryEntry().Properties.Contains("businesscategory") == true) { boolContinue = true; strXID = oCollection[0].GetDirectoryEntry().Properties["businesscategory"].Value.ToString(); oUser.Update(intUser, strXID, strID); } else if (strXID != "") { oCollection = oFunction.eDirectory("businesscategory", strXID); if (oCollection.Count == 1) { boolContinue = true; strID = oCollection[0].GetDirectoryEntry().Properties["cn"].Value.ToString(); oUser.Update(intUser, strXID, strID); } else { Response.Redirect(Request.Path + "?id=" + Request.QueryString["id"] + "&userid=" + intUser.ToString() + "&admin=" + (chkAdmin.Checked ? "1" : "0") + "&remote=" + (chkRemote.Checked ? "1" : "0")); } } } else { boolContinue = true; } if (boolContinue == true) { oWorkstation.AddAccountFix(0, intWorkstation, intUser, (chkAdmin.Checked ? 1 : 0), (chkRemote.Checked ? 1 : 0)); Response.Redirect(Request.Path + "?id=" + Request.QueryString["id"] + "&add=true"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "offshore", "<script type=\"text/javascript\">alert('There was a problem finding the user in the directory.');<" + "/" + "script>"); } } }