示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Master.PageTitle = "Blog";
                if (CurrentAnnouncement == 0)
                {
                    LoadCircularsPublic();
                    LoadCircularsGroup();
                    uiPanelViewAll.Visible = true;
                    uiPanelCurrent.Visible = false;
                }
                else
                {
                    LoadCurrent();
                    uiPanelViewAll.Visible = false;
                    uiPanelCurrent.Visible = true;
                }
                MarkNotificationsAsRead();

                UsersProfiles userProf = new UsersProfiles();
                userProf.getUserByGUID(new Guid(Membership.GetUser(Page.User.Identity.Name).ProviderUserKey.ToString()));

                Groups grps = new Groups();
                grps.LoadByPrimaryKey(userProf.GroupID);
                lblTabGroup.Text = grps.GroupName + " Blogs";
            }
        }
示例#2
0
 private void LoadData()
 {
     Groups grps = new Groups();
     grps.LoadAll();
     DropDownListGroups.DataSource = grps.DefaultView;
     DropDownListGroups.DataTextField = Groups.ColumnNames.GroupName.ToString();
     DropDownListGroups.DataValueField = Groups.ColumnNames.GroupID.ToString();
     DropDownListGroups.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Master.PageTitle = "Send Notifications Mails";
         Groups grps = new Groups();
         grps.LoadAll();
         CheckBoxListGroups.DataSource = grps.DefaultView;
         CheckBoxListGroups.DataTextField = Groups.ColumnNames.GroupName;
         CheckBoxListGroups.DataValueField = Groups.ColumnNames.GroupID;
         CheckBoxListGroups.DataBind();
     }
 }
        protected void LinkButtonSendNotifications_Click(object sender, EventArgs e)
        {
            uiPanelSuccess.Visible = false;
            UsersProfiles up = new UsersProfiles();
            Groups gr = new Groups();
            List<string> GroupIDs = CheckBoxListGroups.Items.Cast<ListItem>()
                .Where(li => li.Selected)
                .Select(li => li.Value)
                .ToList();

            if(GroupIDs.Count>0)
                up.getuserEmails(GroupIDs);
            try
            {
                MailMessage msg = new MailMessage();
                string mail = GetLocalResourceObject("FromMail").ToString();
                for (int i = 0; i < up.RowCount; i++)
                {
                    msg.To.Add(up.Email);
                    up.MoveNext();
                }
                if (!string.IsNullOrEmpty(uiHiddenFieldmails.Value))
                    msg.To.Add(uiHiddenFieldmails.Value);
                msg.From = new MailAddress(mail);
                msg.Subject = GetLocalResourceObject("subject").ToString();
                msg.IsBodyHtml = true;
                msg.BodyEncoding = System.Text.Encoding.UTF8;
                msg.Body = uiRadEditorContnet.GetHtml(Telerik.Web.UI.EditorStripHtmlOptions.None);
                SmtpClient client = new SmtpClient(GetLocalResourceObject("Server").ToString(), Convert.ToInt32(GetLocalResourceObject("Port").ToString()));
                //SmtpClient client = new SmtpClient(GetLocalResourceObject("server").ToString(), 25);
                client.EnableSsl = false;
                client.UseDefaultCredentials = false;
                client.Credentials = new System.Net.NetworkCredential(mail, GetLocalResourceObject("Password").ToString());
                client.Send(msg);
                uiPanelSuccess.Visible = true;

            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private void loadGroups()
        {
            Groups grps = new Groups();
            grps.LoadAll();

            CheckBoxListGroups.DataSource = grps.DefaultView;
            CheckBoxListGroups.DataTextField = Groups.ColumnNames.GroupName.ToString();
            CheckBoxListGroups.DataValueField = Groups.ColumnNames.GroupID.ToString();
            CheckBoxListGroups.DataBind();
            CheckBoxListGroups.Items.Insert(0, new ListItem("Public", "0"));
        }