示例#1
0
        public ActionResult RemindSave(B_Remind entity)
        {
            BLL.Notice.NoticeList notice = new BLL.Notice.NoticeList();

            entity.发送对象 = Request.Form["telList"];

            entity.是否发送 = "N";

            int WorkerID = int.Parse(User.Identity.Name.Split('|')[0]);

            entity.操作员编码 = notice.GetEmpNoByWorkerID(WorkerID); //获取发送人的工号

            if (ModelState.IsValid)
            {
                bool save = notice.Save(entity);

                if (save)
                {
                    return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Message = "保存失败" }, "text/html", JsonRequestBehavior.AllowGet));
                }
            }

            return(View());
        }
示例#2
0
        public static bool Delete(IList <int> idList)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                try
                {
                    foreach (int g in idList)
                    {
                        B_Remind model = dbContext.B_Remind.SingleOrDefault(t => t.编码 == g);
                        if (model != null)
                        {
                            dbContext.B_Remind.DeleteOnSubmit(model);
                        }
                    }
                    dbContext.SubmitChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    Log4Net.LogError("定时短信删除", ex.ToString());

                    return(false);
                }
            }
        }
示例#3
0
        public ActionResult RemindEdit(int?Id)
        {
            BLL.Notice.NoticeList notice = new BLL.Notice.NoticeList();

            B_Remind remind = notice.Edit(Id) as B_Remind;

            this.ViewData["entity"] = remind;
            this.ViewData["time"]   = remind.提醒时间.ToString("yyyy-MM-dd HH:mm:ss");;

            this.ViewData["OwnerID"] = int.Parse(User.Identity.Name.Split('|')[0]);
            return(View());
        }
示例#4
0
        public static bool Save(B_Remind entity)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                try
                {
                    if (entity.编码 == 0) //添加
                    {
                        var  list  = from p in dbContext.B_Remind select p.编码;
                        long total = list.LongCount();
                        if (total == 0)
                        {
                            entity.编码 = 1;
                        }
                        else
                        {
                            entity.编码 = dbContext.B_Remind.Max(t => t.编码) + 1;
                        }

                        dbContext.B_Remind.InsertOnSubmit(entity);
                        dbContext.SubmitChanges();
                        return(true);
                    }
                    else //修改
                    {
                        var model = dbContext.B_Remind.FirstOrDefault(t => t.编码 == entity.编码);
                        model.编码   = entity.编码;
                        model.发送对象 = entity.发送对象;
                        model.内容   = entity.内容;
                        model.提醒时间 = entity.提醒时间;
                        dbContext.SubmitChanges();
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    Log4Net.LogError("定时短信", ex.ToString());

                    return(false);
                }
            }
        }
示例#5
0
 public static object Edit(int?id)
 {
     using (MainDataContext dbContext = new MainDataContext())
     {
         B_Remind entity = null;
         if (id != null)
         {
             entity = dbContext.B_Remind.FirstOrDefault(t => t.编码 == id);
         }
         entity = entity ?? new B_Remind
         {
             编码    = 0,
             内容    = string.Empty,
             发送对象  = string.Empty,
             提醒时间  = DateTime.Now,
             操作员编码 = string.Empty,
         };
         return(entity);
     }
 }
示例#6
0
 public bool Save(B_Remind entity)
 {
     return(DAL.Notice.NoticeList.Save(entity));
 }