protected void btnSave_Click(Object Sender, EventArgs e) { int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text); int intResourceParent = oResourceRequest.GetWorkflowParent(intResourceWorkflow); oResourceRequest.UpdateWorkflowName(intResourceWorkflow, txtCustom.Text, intProfile); ds = oResourceRequest.Get(intResourceParent); int intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString()); int intItem = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString()); int intStatus = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "status")); double dblHours = double.Parse(lblUsed.Text); double dblTime = 5.00 / 60.00; foreach (RepeaterItem ri in rptView.Items) { CheckBox chkDelete = (CheckBox)ri.FindControl("chkDelete"); if (chkDelete.Checked == true) { Label lblId = (Label)ri.FindControl("lblId"); Label lblPath = (Label)ri.FindControl("lblPath"); Label lblEnvironment = (Label)ri.FindControl("lblEnvironment"); Variables oVariable = new Variables(Int32.Parse(lblEnvironment.Text)); DirectoryEntry oEntry = new DirectoryEntry(lblPath.Text, oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword()); AD oAD = new AD(intProfile, dsn, Int32.Parse(lblEnvironment.Text)); if (oAD.Exists(oEntry)) { oAD.Enable(oEntry, false); } dblHours += dblTime; oADObject.UpdateDomainAccount(Int32.Parse(lblId.Text), intProfile); } } // Delete objects over a month old ds = oADObject.GetDomainAccountsDisabled(DateTime.Today.AddMonths(-1)); foreach (DataRow dr in ds.Tables[0].Rows) { int _environment = Int32.Parse(dr["environment"].ToString()); Variables oVariable = new Variables(_environment); DirectoryEntry oEntry = new DirectoryEntry(dr["path"].ToString(), oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword()); AD oAD = new AD(intProfile, dsn, _environment); if (oAD.Exists(oEntry) && oAD.IsDisabled(oEntry) == true) { oAD.Delete(oEntry); oADObject.UpdateDomainAccountDisabled(Int32.Parse(dr["adid"].ToString()), -1); } else { oADObject.UpdateDomainAccountDisabled(Int32.Parse(dr["adid"].ToString()), -10); } } double dblTotal = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated")); double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow); dblHours = (dblHours - dblUsed); if (dblHours > 0.00) { oResourceRequest.UpdateWorkflowHours(intResourceWorkflow, dblHours); } Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&save=true"); }