Пример #1
0
    private void Process_SynchCMSGroupsToAD()
    {
        Collection cUserIDs = new Collection();
            Collection cADUsernames = new Collection();
            Collection cADDomains = new Collection();
            Collection cActions = new Collection();
            int count;
            long userid = 0;
            string adusername = string.Empty;
            string addomain = string.Empty;
            string addelete = string.Empty;
            for (count = 1; count <= System.Convert.ToInt32(Request.Form["usercount"]); count++)
            {
                if (!(Request.Form["userid" + count.ToString()] == null))
                {
                    if(Request.Form["userid" + count.ToString()] != null)
                        userid = System.Convert.ToInt64(Request.Form["userid" + count.ToString()]);
                    if (Request.Form["username" + count.ToString()] != null)
                        adusername = Request.Form["username" + count.ToString()].ToString();
                    if(Request.Form["domain" + count.ToString()] != null)
                        addomain = Request.Form["domain" + count.ToString()].ToString();
                    if(Request.Form["delete" + count.ToString()] != null)
                        addelete = Request.Form["delete" + count.ToString()].ToString();

                    if (addelete != "")
                    {
                        cUserIDs.Add(userid, count.ToString(), null, null);
                        cADUsernames.Add("", count.ToString(), null, null);
                        cADDomains.Add("", count.ToString(), null, null);
                        cActions.Add("delete", count.ToString(), null, null);
                    }
                    else if ((adusername != "") && (addomain != ""))
                    {
                        cUserIDs.Add(userid, count.ToString(), null, null);
                        cADUsernames.Add(adusername, count.ToString(), null, null);
                        cADDomains.Add(addomain, count.ToString(), null, null);
                        cActions.Add("map", count.ToString(), null, null);
                    }
                }
            }

            m_refUserApi = new UserAPI();
            m_refUserApi.SynchCMSGroupsToAD(cUserIDs, cADUsernames, cADDomains, cActions);

            Response.Redirect("adreports.aspx?action=GetGroupsForSynch", false);
    }