private void Process_DeSynchUsers() { AdDeSyncUserData[] result; m_refUserApi = new UserAPI(); try { result = m_refUserApi.DeSynchUsers(true); //Response.Redirect("adreports.aspx?action=ViewAllReportTypes", False) Response.Redirect("users.aspx?backaction=viewallusers&action=viewallusers&grouptype=0&groupid=2&id=2&FromUsers=1", false); } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
private void DeSynchUsers() { try { TR_count.Visible = true; string usersForm = Request.Form["submitted"]; AdDeSyncUserData[] result; m_refSiteApi = new SiteAPI(); m_refUserApi = new UserAPI(); if (usersForm != "") { result = m_refUserApi.DeSynchUsers(true); Response.Redirect("adreports.aspx?action=ViewAllReportTypes", false); } else { settings_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId); result = m_refUserApi.DeSynchUsers(false); if (result == null) { Response.Redirect("adreports.aspx?action=ViewAllReportTypes", false); } System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "CMSUSER"; colBound.HeaderText = m_refMsg.GetMessage("generic Username"); colBound.HeaderStyle.Width = Unit.Percentage(25); colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; AdReportsGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "AT"; colBound.HeaderText = "@"; colBound.HeaderStyle.Width = Unit.Percentage(2); colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; AdReportsGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TITLE"; colBound.HeaderText = m_refMsg.GetMessage("domain title"); colBound.HeaderStyle.Width = Unit.Percentage(25); colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; AdReportsGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "USER"; colBound.HeaderText = m_refMsg.GetMessage("unique username"); colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; AdReportsGrid.Columns.Add(colBound); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("CMSUSER", typeof(string))); dt.Columns.Add(new DataColumn("AT", typeof(string))); dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("USER", typeof(string))); int i = 0; long currentUserID = m_refUserApi.UserId; if (!(settings_data.ADAuthentication == 1)) { for (i = 0; i <= result.Length - 1; i++) { dr = dt.NewRow(); dr[0] = result[i].OldUserName; dr[1] = "@"; dr[2] = result[i].OldUserDomain; dr[3] = result[i].NewUserName; dt.Rows.Add(dr); } AdReportsGrid.ShowFooter = true; } usercount.Value = i.ToString() + 1; DataView dv = new DataView(dt); AdReportsGrid.DataSource = dv; AdReportsGrid.DataBind(); } DeSynchUsersToolBar(); } catch (Exception ex) { throw (new Exception(ex.Message)); } }