Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (string idStr in this.scReceiveUser.SelectedValues)
         {
             int?id = idStr.ToIntNullable();
             if (id != null)
             {
                 SysRemind remind = new SysRemind()
                 {
                     RemindName   = this.txtTitle.Text.Trim(),
                     Content      = this.txtContent.Value,
                     CreateUserId = this.LoginUserID,
                     OwnerId      = id.Value,
                     CreateTime   = DateTime.Now,
                     State        = (int)RemindStausEnum.New,
                 };
                 this.RemindHelper.Save(remind);
             }
         }
         Response.Redirect("../SystemManagement/SysRemindManagement.aspx");
     }
     catch (Exception ex)
     {
         this.AjaxAlert(ex);
     }
 }
Esempio n. 2
0
        public void Delete(int id)
        {
            SysRemind remind = this.context.FindById <SysRemind>(new object[] { id });

            if (remind == null)
            {
                throw new Exception("传入的主键有误,查询不到提醒信息!");
            }
            this.context.Delete(remind);
        }
Esempio n. 3
0
        public void Update(SysRemind entity)
        {
            SysRemind remind = this.context.FindById <SysRemind>(new object[] { entity.RemindId });

            if (string.IsNullOrEmpty(entity.RemindName))
            {
                throw new Exception("提醒必须设置主题!");
            }
            remind.RemindName = entity.RemindName;
            remind.DeadLine   = entity.DeadLine;
            remind.RemindURL  = entity.RemindURL;
            remind.State      = entity.State;
            this.context.Update(remind);
        }
Esempio n. 4
0
 public int Save(SysRemind entity)
 {
     entity.RemindId = this.context.GetNextIdentity_Int(false);
     if (string.IsNullOrEmpty(entity.RemindName))
     {
         throw new Exception("提醒必须设置主题!");
     }
     entity.CreateTime = new DateTime?(DateTime.Now);
     if (!(entity.OwnerId.HasValue && (entity.OwnerId.Value > 0)))
     {
         throw new Exception("提醒必须设置OwnerId!");
     }
     if (!(entity.State.HasValue && (entity.State.Value >= 0)))
     {
         entity.State = 0;
     }
     this.context.Insert(entity);
     return(entity.RemindId);
 }