Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                TblNotificationAlert obj = new TblNotificationAlert();

                if (ddlBranches.SelectedValue == "-2")
                {
                    DataTable dt = helper.ExecutePlainQuery("select * from tbl_Branches where isActive=1");

                    foreach (DataRow dr in dt.Rows)
                    {
                        obj.IsNew               = true;
                        obj.BranchID            = Convert.ToInt32(dr["BranchID"]);
                        obj.NotificationDate    = helper.getDateTime();
                        obj.NotificationFrom    = Session["Email"].ToString();
                        obj.NotificationMessage = txtMessage.Text;
                        obj.NotificationTo      = txtNotificationTo.Text;
                        obj.NotificationSubject = txtSubject.Text;
                        obj.NotificationCode    = helper.generateRandomCode(4);
                        obj.IsActive            = true;
                        obj.IsRead              = false;
                        obj.Save();
                    }
                }
                else
                {
                    obj.IsNew               = true;
                    obj.BranchID            = Convert.ToInt32(ddlBranches.SelectedValue);
                    obj.NotificationDate    = helper.getDateTime();
                    obj.NotificationFrom    = Session["Email"].ToString();
                    obj.NotificationMessage = txtMessage.Text;
                    obj.NotificationTo      = txtNotificationTo.Text;
                    obj.NotificationSubject = txtSubject.Text;
                    obj.NotificationCode    = helper.generateRandomCode(4);
                    obj.IsActive            = true;
                    obj.IsRead              = false;
                    obj.Save();
                }


                lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, "Notification has been sent!", "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check");
                helper.ClearInputs(Page.Controls);
            }
            catch (Exception ex) {
                lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, ex.ToString(), "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o");
            }
        }
Example #2
0
        private void MessageRead()
        {
            TblNotificationAlert objAlert = new TblNotificationAlert(Request.QueryString["val"]);

            objAlert.IsNew  = false;
            objAlert.IsRead = true;
            objAlert.Save();
        }