Ejemplo n.º 1
0
        public CommonDbResponse ManageNotification(MobileNotificationCommon mnc)
        {
            var sql = "Exec Sproc_mobile_notification ";

            sql += "@flag = '" + (string.IsNullOrEmpty(mnc.NotificationId) ? "i" : "u") + "' ";
            sql += ",@notification_id=" + dao.FilterString(mnc.NotificationId);
            sql += ",@notification_subject=" + dao.FilterString(mnc.NotificationSubject);
            sql += ",@notification_subtitle=" + dao.FilterString(mnc.NotificationSubtitle);
            sql += ",@notification_body=" + dao.FilterString(mnc.NotificationBody);
            //sql += ",@notification_image_url=" + dao.FilterString(mnc.NotificationImageUrl);
            sql += ",@notification_image_url=" + dao.FilterString(mnc.ImageUpload);
            sql += ",@action_id=" + dao.FilterString(mnc.ActionId);
            sql += ",@notification_type=" + dao.FilterString(mnc.NotificationType);
            sql += ",@notification_importance_level=" + dao.FilterString(mnc.NotificationImportanceLevel);
            sql += ",@notification_status=" + dao.FilterString(mnc.NotificationStatus);
            sql += ",@is_background=" + dao.FilterString(mnc.IsBackground);
            sql += ",@notification_to=" + dao.FilterString(mnc.NotificationTo);
            sql += ",@agent_id=" + dao.FilterString(mnc.AgentId);
            sql += ",@user_id=" + dao.FilterString(mnc.UserId);
            sql += ",@action_user="******",@txn_id=" + dao.FilterString(mnc.TxnId);
            sql += ",@read_status=" + dao.FilterString(mnc.ReadStatus);
            sql += ",@txn_status_id=" + dao.FilterString(mnc.TxnStatusId);
            sql += ",@txn_status=" + dao.FilterString(mnc.TxnStatus);
            return(dao.ParseCommonDbResponse(sql));
        }
Ejemplo n.º 2
0
        public MobileNotificationCommon GetNotificationById(string notificationid, string username)
        {
            var sql = "Exec Sproc_mobile_notification ";

            sql += "@flag = 'sid' ";
            sql += "@notification_id =" + dao.FilterString(notificationid);
            sql += "@action_user ="******"notification_id"].ToString();
                common.NotificationSubject         = dt["notification_subject"].ToString();
                common.NotificationSubtitle        = dt["notification_subtitle"].ToString();
                common.NotificationBody            = dt["notification_body"].ToString();
                common.NotificationImageUrl        = dt["notification_image_url"].ToString();
                common.ActionId                    = dt["action_id"].ToString();
                common.NotificationType            = dt["notification_type"].ToString();
                common.NotificationImportanceLevel = dt["notification_importance_level"].ToString();
                common.NotificationStatus          = dt["notification_status"].ToString();
                common.IsBackground                = dt["is_background"].ToString();
                common.NotificationTo              = dt["notification_to"].ToString();
                common.AgentId     = dt["agent_id"].ToString();
                common.UserId      = dt["user_id"].ToString();
                common.CreateDate  = dt["created_local_date"].ToString();
                common.TxnId       = dt["txn_id"].ToString();
                common.ReadStatus  = dt["read_status"].ToString();
                common.TxnStatusId = dt["txn_status_id"].ToString();
                common.TxnStatus   = dt["txn_status"].ToString();
            }
            return(common);
        }
Ejemplo n.º 3
0
        public List <MobileNotificationCommon> GetNotificationList()
        {
            var sql = "Exec Sproc_mobile_notification ";

            sql += "@flag = 's' ";
            var dt   = dao.ExecuteDataTable(sql);
            var list = new List <MobileNotificationCommon>();

            if (dt != null)
            {
                foreach (DataRow item in dt.Rows)
                {
                    var common = new MobileNotificationCommon
                    {
                        NotificationId       = item["notification_id"].ToString(),
                        NotificationSubject  = item["notification_subject"].ToString(),
                        NotificationSubtitle = item["notification_subtitle"].ToString(),
                        NotificationType     = item["notification_type"].ToString(),
                        NotificationStatus   = item["notification_status"].ToString()
                    };
                    list.Add(common);
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        public ActionResult Manage(MobileNotificationModel mnm, HttpPostedFileBase Image_Upload)
        {
            var ImagePath = "";

            ViewBag.importancelevel = ApplicationUtilities.SetDDLValue(LoadDropdownList("importance"), "", "--select Importance Level--");
            if (ModelState.IsValid)
            {
                MobileNotificationCommon mnc = new MobileNotificationCommon();
                mnc = mnm.MapObject <MobileNotificationCommon>();
                if (!string.IsNullOrEmpty(mnc.NotificationId))
                {
                    if (string.IsNullOrEmpty(mnc.NotificationId.DecryptParameter()))
                    {
                        return(View("Manage", mnm));
                    }
                    mnc.NotificationId = mnc.NotificationId.DecryptParameter();
                }
                if (Image_Upload != null)
                {
                    var    contentType       = Image_Upload.ContentType;
                    var    allowedExtensions = new[] { ".jpg", ".png", ".jpeg" };
                    var    fileName          = Path.GetFileName(Image_Upload.FileName);
                    String timeStamp         = DateTime.Now.ToString();
                    var    ext = Path.GetExtension(Image_Upload.FileName);
                    if (Image_Upload.ContentLength > 1 * 1024 * 1024)//1 MB
                    {
                        this.ShowPopup(1, "Image Size must be less than 1MB");
                        return(View(mnm));
                    }
                    if (allowedExtensions.Contains(ext.ToLower()))
                    {
                        string datet      = DateTime.Now.ToString().Replace('/', ' ').Replace(':', ' ');
                        string myfilename = "logo " + datet + ext.ToLower();
                        ImagePath       = Path.Combine(Server.MapPath("~/Content/userupload/Notification"), myfilename);
                        mnc.ImageUpload = "/Content/userupload/Notification/" + myfilename;
                    }
                    else
                    {
                        this.ShowPopup(1, "File Must be .jpg,.png,.jpeg");
                        return(View(mnm));
                    }
                }
                mnc.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString();
                var dbresp = buss.ManageNotification(mnc);
                if (dbresp.Code == 0)
                {
                    if (Image_Upload != null)
                    {
                        Image_Upload.SaveAs(ImagePath);
                    }
                    this.ShowPopup(0, "successfully Inserted");
                    return(RedirectToAction("Index"));
                }
            }
            this.ShowPopup(1, "Error");
            return(View(mnm));
        }
Ejemplo n.º 5
0
        public ActionResult Manage(string id)
        {
            MobileNotificationModel mnm = new MobileNotificationModel();
            string username             = ApplicationUtilities.GetSessionValue("username").ToString();

            ViewBag.importancelevel = ApplicationUtilities.SetDDLValue(LoadDropdownList("importance"), "", "--Select Importance Level--");
            if (!string.IsNullOrEmpty(id))
            {
                if (!string.IsNullOrEmpty(id.DecryptParameter()))
                {
                    MobileNotificationCommon mnc = new MobileNotificationCommon();
                    mnc = buss.GetNotificationById(id.DecryptParameter(), username);
                }
            }
            return(View(mnm));
        }
 public CommonDbResponse ManageNotification(MobileNotificationCommon mnc)
 {
     return(repo.ManageNotification(mnc));
 }