示例#1
0
 void fill()
 {
     try
     {
         Song.Entities.Notice mm;
         if (id != 0)
         {
             mm = Business.Do <INotice>().NoticeSingle(id);
             tbStarTime.Text  = ((DateTime)mm.No_StartTime).ToString("yyyy-MM-d HH:mm:ss");
             cbIsShow.Checked = mm.No_IsShow;
             tbName.Text      = mm.Acc_Name;
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Notice();
             tbStarTime.Text = DateTime.Now.ToString("yyyy-MM-d HH:mm:ss");
             //当前登录用户的名称
             tbName.Text = Extend.LoginState.Admin.CurrentUser.Acc_Name;
         }
         tbTtl.Text     = mm.No_Ttl;
         tbContent.Text = mm.No_Context;
         tbName.Text    = mm.Acc_Name;
         //发布单位
         tbOrg.Text = mm.No_Organ;
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
示例#2
0
 public bool Add(Song.Entities.Notice entity)
 {
     try
     {
         Business.Do <INotice>().Add(entity);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
        public bool Modify(Song.Entities.Notice entity)
        {
            Song.Entities.Notice old = Business.Do <INotice>().NoticeSingle(entity.No_Id);
            if (old == null)
            {
                throw new Exception("对象不存在!");
            }

            old.Copy <Song.Entities.Notice>(entity);
            Business.Do <INotice>().Save(old);
            return(true);
        }
示例#4
0
        /// <summary>
        /// 当前公告的下一条公告
        /// </summary>
        /// <param name="identify"></param>
        /// <returns></returns>
        public Notice NoticeNext(int identify, int orgid)
        {
            WhereClip wc = new WhereClip();

            if (orgid > 0)
            {
                wc &= Notice._.Org_ID == orgid;
            }
            wc &= Notice._.No_IsShow == true;
            wc &= Notice._.No_StartTime < DateTime.Now;
            Song.Entities.Notice no = this.NoticeSingle(identify);
            return(Gateway.Default.From <Notice>().OrderBy(Notice._.No_StartTime.Desc)
                   .Where(wc && Notice._.No_StartTime < no.No_StartTime).ToFirst <Notice>());
        }
示例#5
0
 /// <summary>
 /// 修改是否显示的状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void sbShow_Click(object sender, EventArgs e)
 {
     try
     {
         StateButton ub    = (StateButton)sender;
         int         index = ((GridViewRow)(ub.Parent.Parent)).RowIndex;
         int         id    = int.Parse(this.GridView1.DataKeys[index].Value.ToString());
         //
         Song.Entities.Notice entity = Business.Do <INotice>().NoticeSingle(id);
         entity.No_IsShow = !entity.No_IsShow;
         Business.Do <INotice>().Save(entity);
         BindData(null, null);
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }
示例#6
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEnter_Click(object sender, EventArgs e)
 {
     try
     {
         Song.Entities.Notice mm;
         if (id != 0)
         {
             mm = Business.Do <INotice>().NoticeSingle(id);
         }
         else
         {
             //如果是新增
             mm = new Song.Entities.Notice();
         }
         //公告标题
         mm.No_Ttl     = tbTtl.Text;
         mm.No_IsShow  = cbIsShow.Checked;
         mm.No_Context = tbContent.Text;
         //发布时间
         mm.No_StartTime = Convert.ToDateTime(tbStarTime.Text);
         //
         mm.No_Organ = tbOrg.Text;
         //确定操作
         if (id == 0)
         {
             EmpAccount acc = Extend.LoginState.Admin.CurrentUser;
             mm.Acc_Id   = acc.Acc_Id;
             mm.Acc_Name = acc.Acc_Name;
             Business.Do <INotice>().Add(mm);
         }
         else
         {
             Business.Do <INotice>().Save(mm);
         }
         Master.AlertCloseAndRefresh("操作成功!");
     }
     catch (Exception ex)
     {
         Message.ExceptionShow(ex);
     }
 }