} // end lbtnAddGroupMembers_Click

    /// <summary>
    /// Updates the changes on the group in Active Directory
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lbtnUpdateGroupMembers_Click(object sender, EventArgs e)
    {
        var    memberDNs     = new List <string>();
        string objContentMsg = "";
        string objContentMsgGrp;
        int    retval;
        int    retvalGrp;
        string objsearchfilter = "user";
        var    adrw            = new ADrwInfo();
        var    adMemberIn      = new ADobjInfo();

        for (int i = 0; i < lstGroupMembers.Items.Count; i++)
        {
            adMemberIn.ADUserID = lstGroupMembers.Items[i].Value.ToString();
            var adMemberOut = adrw.RetObjValues(ref objContentMsg, out retval, objsearchfilter, adMemberIn);

            if (!String.IsNullOrEmpty(adMemberOut.ADdistinguishedName))
            {
                memberDNs.Add(adMemberOut.ADdistinguishedName);
            }
        }

        string adGrpUpdIn = ViewState["agGrpSelected"].ToString();

        adrw.AddUsersToGroup(out objContentMsgGrp, out retvalGrp, adGrpUpdIn, memberDNs);

        string appTextError = "", appLanguage = "";
        var    appText       = new System.Collections.Generic.Dictionary <string, string>();
        bool   foundLangFile = WbVarious.GetAppText(ref appText, ref appTextError, appLanguage);

        string errorExceptionTxt, operationFinishedtxt;
        string feedback = "";

        appText.TryGetValue("ErrorException", out errorExceptionTxt);
        appText.TryGetValue("OperationFinished", out operationFinishedtxt);

        if (retvalGrp != 0)
        {
            feedback = errorExceptionTxt;
            lblAppFeedback.Attributes.Remove("class");
            lblAppFeedback.Attributes.Add("class", "labelfeedbad");
        }
        else
        {
            feedback = operationFinishedtxt;
            lblAppFeedback.Attributes.Remove("class");
            lblAppFeedback.Attributes.Add("class", "labelfeedgood");
        }

        lblAppFeedback.Text = feedback;

        Hide_Buttons();

        if (WbGetParams.getBValue("WriteUsageLog"))
        {
            Update_UsageLog();
        }
    } // end lbtnUpdateGroupMembers_Click
Example #2
0
    public void SendMailNotification()
    {
        string mailbody = @"
            <style>
                p
                {
                   font-size: 11px;
                   font-family: Verdana, sans-serif;   
                   color: #004595; 
                }
                .othercolor
                {
                    color: #ff7e00;
                }                    
            </style>
        " + notifymsg;

        string      mailSubject = "SIG-GroupManagmentTool Notification on: " + DateTime.Now.ToString();
        MailMessage myMessage   = new MailMessage(WbGetParams.getValue("NotifyFromAddress"), Notifyrcp, mailSubject, mailbody);

        myMessage.IsBodyHtml = true;
        if (WbGetParams.getBValue("SendAdminBccNotification"))
        {
            MailAddress bcc = new MailAddress(WbGetParams.getValue("NotifyAdminToAddress"));
            myMessage.Bcc.Add(bcc);
        }
        SmtpClient mySmtpClient = new SmtpClient(WbGetParams.getValue("NotifyExchangeServer"));

        try
        {
            mySmtpClient.Send(myMessage);
        }
        catch
        {
            string foo = "bar";
        }
    }