Esempio n. 1
0
        public ActionResult ChangeStateNotice(int id)
        {
            string result = "";

            try
            {
                tbl_NoticeBoardMaster abc = _notice.Get(id);
                var st = abc.Active;
                if (!String.IsNullOrWhiteSpace(st.ToString()))
                {
                    int _st = Convert.ToInt32(st);
                    if (_st == 1)
                    {
                        abc.Active = 0;
                        _notice.Update(abc);
                        result = "Deactive";
                    }
                    else
                    {
                        abc.Active = 1;
                        _notice.Update(abc);
                        result = "Active";
                    }
                }
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
 public ActionResult Addnotice(tbl_NoticeBoardMasterss model, HttpPostedFileBase image)
 {
     try
     {
         if (model.pkid == 0)
         {
             tbl_NoticeBoardMaster abc = new tbl_NoticeBoardMaster();
             if (image != null)
             {
                 WebFunction web = new WebFunction();
                 model.Image_Path = web.Storefile(image, 2);
             }
             abc.NoticeName        = model.NoticeName;
             abc.NoticeDescription = model.NoticeDescription;
             abc.Image_Path        = model.Image_Path;
             abc.AddedDate         = DateTime.Now;
             abc.RequiredDays      = model.RequiredDays;
             abc.Active            = model.Active;
             abc.LastModifiedDate  = DateTime.Now;
             _notice.Add(abc);
         }
         else
         {
             int _id = Convert.ToInt32(model.pkid);
             tbl_NoticeBoardMaster abc = _notice.Get(_id);
             if (image != null)
             {
                 string path = System.Web.HttpContext.Current.Server.MapPath(model.Image_Path);
                 if (System.IO.File.Exists(path))
                 {
                     System.IO.File.Delete(path);
                 }
                 WebFunction web = new WebFunction();
                 model.Image_Path = web.Storefile(image, 2);
             }
             abc.pkid              = model.pkid;
             abc.NoticeName        = model.NoticeName;
             abc.NoticeDescription = model.NoticeDescription;
             abc.Image_Path        = model.Image_Path;
             abc.AddedDate         = model.AddedDate;
             abc.RequiredDays      = model.RequiredDays;
             abc.Active            = model.Active;
             abc.LastModifiedDate  = DateTime.Now;
             _notice.Update(abc);
         }
         return(RedirectToAction("Addnotice", "Administration"));
     }
     catch (Exception e)
     {
         Commonfunction.LogError(e, Server.MapPath("~/Log.txt"));
         ViewBag.Exception = e.Message;
         return(View());
     }
 }
Esempio n. 3
0
 public ActionResult DeleteNotice(int id)
 {
     try
     {
         tbl_NoticeBoardMaster abc = _notice.Get(id);
         _notice.Remove(id, true);
         return(Json("success", JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json("failed", JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 4
0
 public ActionResult Addnotice(string id)
 {
     if (!String.IsNullOrWhiteSpace(id))
     {
         int _id = Convert.ToInt32(id);
         tbl_NoticeBoardMaster   model = _notice.Get(_id);
         tbl_NoticeBoardMasterss abc   = new tbl_NoticeBoardMasterss();
         abc.pkid              = model.pkid;
         abc.NoticeName        = model.NoticeName;
         abc.NoticeDescription = model.NoticeDescription;
         abc.Image_Path        = model.Image_Path;
         abc.AddedDate         = model.AddedDate;
         abc.RequiredDays      = model.RequiredDays;
         abc.Active            = model.Active;
         return(View(abc));
     }
     return(View());
 }