Exemplo n.º 1
0
        protected void btn_Compelete_Click(object sender, EventArgs e)
        {
            try
            {
                string ids = this.hf_CheckIDS.Value.TrimEnd(',');

                using (IFMPDBContext db = new IFMPDBContext())
                {
                    foreach (string id in ids.Split(','))
                    {
                        int       selid     = Convert.ToInt32(id);
                        ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.IsDel != true && t.CreateUserID == UserID && t.AuditState == AuditState.通过);
                        if (ScoreTask != null)
                        {
                            ScoreTask.AuditState = AuditState.确认完成;
                        }
                    }
                    db.SaveChanges();

                    new SysLogDAO().AddLog(LogType.操作日志_修改, "确认完成成功", UserID);
                    ShowMessage("确认成功");
                    DataBindList();
                    this.hf_CheckIDS.Value = "";
                }
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                ShowMessage(ex.Message);
                return;
            }
        }
Exemplo n.º 2
0
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                string ids = this.hf_CheckIDS.Value.TrimEnd(',');
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    try
                    {
                        foreach (string id in ids.Split(','))
                        {
                            int       selid     = Convert.ToInt32(id);
                            ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.ID == selid);
                            ScoreTask.IsDel = true;
                        }
                        db.SaveChanges();

                        new SysLogDAO().AddLog(LogType.操作日志_删除, "删除任务信息", UserID);
                        ShowMessage("删除成功");
                    }
                    catch
                    {
                        ShowMessage("删除失败");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                ShowMessage(ex.Message);
            }
            this.hf_CheckIDS.Value = "";
            DataBindList();
        }
Exemplo n.º 3
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.ID == ScoreTaskID);
                    if (ScoreTask == null)
                    {
                        ScoreTask                  = new ScoreTask();
                        ScoreTask.AuditState       = AuditState.待初审;
                        ScoreTask.CompleteBScore   = Convert.ToInt32(this.txt_TScore.Text.Trim());
                        ScoreTask.Content          = this.txt_TaskContent.Text.Trim();
                        ScoreTask.CreateDate       = DateTime.Now;
                        ScoreTask.CreateUserID     = UserID;
                        ScoreTask.EndDate          = Convert.ToDateTime(this.txt_EndDate.Text);
                        ScoreTask.FirstAuditUserID = Convert.ToInt32(this.ddl_FirstAduitUser.SelectedValue);
                        ScoreTask.LastAuditUserID  = Convert.ToInt32(this.ddl_LastAduitUser.SelectedValue);
                        ScoreTask.IsDel            = false;
                        ScoreTask.Name             = this.txt_TaskName.Text.Trim();
                        ScoreTask.SignBScore       = Convert.ToInt32(this.txt_SignScore.Text.Trim());

                        db.ScoreTask.Add(ScoreTask);
                        db.SaveChanges();

                        //发通知
                        Notice Notice = new Notice();
                        Notice.Contenet = "当前有一条任务需要审核|主题:" + ScoreTask.Name + "(" + ScoreTask.CompleteBScore
                                          + "分)"
                                          + "|记录人:" + db.User.FirstOrDefault(t => t.ID == UserID).RealName
                                          + "|初审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.FirstAuditUserID).RealName
                                          + "|终审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.LastAuditUserID).RealName
                                          + "|状态:待初审";
                        Notice.IsSend       = false;
                        Notice.NoticeType   = NoticeType.积分制消息;
                        Notice.ReciveUserID = ScoreTask.FirstAuditUserID;
                        Notice.SendUserID   = UserID;
                        Notice.SourceID     = ScoreTask.ID;
                        Notice.SendDate     = DateTime.Now;
                        Notice.URL          = ParaUtils.SiteURL + "/jfz/app/TaskAudit.html?flag=1&id=" + ScoreTask.ID;
                        db.Notice.Add(Notice);
                        db.SaveChanges();
                    }

                    new SysLogDAO().AddLog(LogType.操作日志_添加, "发布积分任务", UserID);
                    ShowMessage();
                }
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                ShowMessage(ex.Message);
            }
        }
Exemplo n.º 4
0
 public void BindInfo()
 {
     using (IFMPDBContext db = new IFMPDBContext())
     {
         ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.IsDel != true && t.ID == ScoreTaskID);
         if (ScoreTask != null)
         {
             this.txt_SignScore.Text               = ScoreTask.SignBScore.ToString();
             this.txt_TScore.Text                  = ScoreTask.CompleteBScore.ToString();
             this.txt_TaskName.Text                = ScoreTask.Name;
             this.txt_TaskContent.Text             = ScoreTask.Content;
             this.txt_EndDate.Text                 = ScoreTask.EndDate.ToString("yyyy-MM-dd");
             this.ddl_FirstAduitUser.SelectedValue = ScoreTask.FirstAuditUserID.ToString();
             this.ddl_LastAduitUser.SelectedValue  = ScoreTask.LastAuditUserID.ToString();
         }
     }
 }
Exemplo n.º 5
0
        public void BindInfo()
        {
            using (IFMPDBContext db = new IFMPDBContext())
            {
                ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.ID == ScoreTaskID && t.IsDel != true);
                if (ScoreTask != null)
                {
                    this.ltl_EndDate.Text        = ScoreTask.EndDate.ToString("yyyy-MM-dd");
                    this.ltl_FirstAduitDate.Text = ScoreTask.FirstAuditDate == null ? "" : ScoreTask.FirstAuditDate.Value.ToString("yyyy-MM-dd");
                    this.ltl_FirstAduitMess.Text = ScoreTask.FirstAuditMark;
                    this.ltl_FirstAduitUser.Text = db.User.FirstOrDefault(t => t.ID == ScoreTask.FirstAuditUserID).RealName;
                    this.ltl_LastAduitDate.Text  = ScoreTask.LastAuditDate == null ? "" : ScoreTask.LastAuditDate.Value.ToString("yyyy-MM-dd");
                    this.ltl_LastAduitMess.Text  = ScoreTask.LastAuditMark;
                    this.ltl_LastAduitUser.Text  = db.User.FirstOrDefault(t => t.ID == ScoreTask.LastAuditUserID).RealName;
                    this.ltl_SignScore.Text      = ScoreTask.SignBScore.ToString();
                    this.ltl_TaskContent.Text    = ScoreTask.Content;
                    this.ltl_TaskName.Text       = ScoreTask.Name;
                    this.ltl_TaskUser.Text       = db.User.FirstOrDefault(t => t.ID == ScoreTask.CreateUserID).RealName;
                    this.ltl_TScore.Text         = ScoreTask.CompleteBScore.ToString();
                    this.ltl_TState.Text         = Enum.GetName(typeof(AuditState), ScoreTask.AuditState);
                    //List<ScoreTaskUser> ScoreTaskUserList = db.ScoreTaskUser.Where(t => t.ScoreTaskID == ScoreTask.ID).ToList();
                    var list = from scoretaskuser in db.ScoreTaskUser.Where(t => t.ScoreTaskID == ScoreTaskID)
                               join user in db.User.Where(t => t.IsDel != true) on scoretaskuser.UserID equals user.ID
                               orderby scoretaskuser.ID descending
                               select new
                    {
                        UserName = user.RealName,
                        scoretaskuser.CompleteDate,
                    };

                    if (list.Count() > 0)
                    {
                        this.rp_List.DataSource = list.ToList();
                        this.rp_List.DataBind();
                    }
                    else
                    {
                        this.tr.Visible = false;
                    }
                }
            }
        }
Exemplo n.º 6
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.ID == ScoreTaskID);
                    if (ScoreTask != null)
                    {
                        if (ScoreTask.AuditState == AuditState.待初审 && ScoreTask.FirstAuditUserID == UserID)
                        {
                            if (Convert.ToInt32(this.ddl_Audit.SelectedValue) == (int)AuditState.通过)
                            {
                                ScoreTask.AuditState = AuditState.待终审;

                                Notice Notice = new Notice();
                                Notice.Contenet = "当前有一条任务需要审核|主题:" + ScoreTask.Name + "(" + ScoreTask.CompleteBScore
                                                  + "分)"
                                                  + "|记录人:" + db.User.FirstOrDefault(t => t.ID == UserID).RealName
                                                  + "|初审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.FirstAuditUserID).RealName
                                                  + "|终审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.LastAuditUserID).RealName
                                                  + "|状态:待终审";
                                Notice.IsSend       = false;
                                Notice.NoticeType   = NoticeType.积分制消息;
                                Notice.ReciveUserID = ScoreTask.LastAuditUserID;
                                Notice.SendUserID   = UserID;
                                Notice.SourceID     = ScoreTask.ID;
                                Notice.SendDate     = DateTime.Now;
                                Notice.URL          = ParaUtils.SiteURL + "/jfz/app/TaskAudit.html?flag=1&id=" + ScoreTask.ID;
                                db.Notice.Add(Notice);
                            }
                            else if (Convert.ToInt32(this.ddl_Audit.SelectedValue) == (int)AuditState.驳回)
                            {
                                ScoreTask.AuditState = AuditState.驳回;

                                Notice Notice = new Notice();
                                Notice.Contenet = "当前有一条任务被驳回|主题:" + ScoreTask.Name + "(" + ScoreTask.CompleteBScore
                                                  + "分)"
                                                  + "|记录人:" + db.User.FirstOrDefault(t => t.ID == UserID).RealName
                                                  + "|初审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.FirstAuditUserID).RealName
                                                  + "|终审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.LastAuditUserID).RealName
                                                  + "|状态:驳回";
                                Notice.IsSend       = false;
                                Notice.NoticeType   = NoticeType.积分制消息;
                                Notice.ReciveUserID = ScoreTask.CreateUserID;
                                Notice.SendUserID   = UserID;
                                Notice.SourceID     = ScoreTask.ID;
                                Notice.SendDate     = DateTime.Now;
                                Notice.URL          = ParaUtils.SiteURL + "/jfz/app/TaskAudit.html?flag=1&id=" + ScoreTask.ID;
                                db.Notice.Add(Notice);
                            }

                            ScoreTask.FirstAuditDate = DateTime.Now;
                            ScoreTask.FirstAuditMark = this.txt_EventMark.Text.Trim();
                        }


                        if (ScoreTask.AuditState == AuditState.待终审 && ScoreTask.LastAuditUserID == UserID)
                        {
                            if (Convert.ToInt32(this.ddl_Audit.SelectedValue) == (int)AuditState.通过)
                            {
                                ScoreTask.AuditState = AuditState.通过;

                                Notice Notice = new Notice();
                                Notice.Contenet = "当前有一条任务需要通过审核|主题:" + ScoreTask.Name + "(" + ScoreTask.CompleteBScore
                                                  + "分)"
                                                  + "|记录人:" + db.User.FirstOrDefault(t => t.ID == UserID).RealName
                                                  + "|初审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.FirstAuditUserID).RealName
                                                  + "|终审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.LastAuditUserID).RealName
                                                  + "|状态:通过";
                                Notice.IsSend       = false;
                                Notice.NoticeType   = NoticeType.积分制消息;
                                Notice.ReciveUserID = ScoreTask.CreateUserID;
                                Notice.SendUserID   = UserID;
                                Notice.SourceID     = ScoreTask.ID;
                                Notice.SendDate     = DateTime.Now;
                                Notice.URL          = ParaUtils.SiteURL + "/jfz/app/TaskAudit.html?flag=1&id=" + ScoreTask.ID;
                                db.Notice.Add(Notice);
                            }
                            else if (Convert.ToInt32(this.ddl_Audit.SelectedValue) == (int)AuditState.驳回)
                            {
                                ScoreTask.AuditState = AuditState.驳回;

                                Notice Notice = new Notice();
                                Notice.Contenet = "当前有一条任务被驳回|主题:" + ScoreTask.Name + "(" + ScoreTask.CompleteBScore
                                                  + "分)"
                                                  + "|记录人:" + db.User.FirstOrDefault(t => t.ID == UserID).RealName
                                                  + "|初审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.FirstAuditUserID).RealName
                                                  + "|终审人:" + db.User.FirstOrDefault(t => t.ID == ScoreTask.LastAuditUserID).RealName
                                                  + "|状态:驳回";
                                Notice.IsSend       = false;
                                Notice.NoticeType   = NoticeType.积分制消息;
                                Notice.ReciveUserID = ScoreTask.CreateUserID;
                                Notice.SendUserID   = UserID;
                                Notice.SourceID     = ScoreTask.ID;
                                Notice.SendDate     = DateTime.Now;
                                Notice.URL          = ParaUtils.SiteURL + "/jfz/app/TaskAudit.html?flag=1&id=" + ScoreTask.ID;
                                db.Notice.Add(Notice);
                            }

                            ScoreTask.LastAuditDate = DateTime.Now;
                            ScoreTask.LastAuditMark = this.txt_EventMark.Text.Trim();
                        }

                        db.SaveChanges();

                        new SysLogDAO().AddLog(LogType.操作日志_添加, "审核任务信息", UserID);
                        ShowMessage();
                    }
                    else
                    {
                        ShowMessage("保存失败");
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                ShowMessage(ex.Message);
            }
        }
Exemplo n.º 7
0
 protected void btn_Sumbit_Click(object sender, EventArgs e)
 {
     try
     {
         using (IFMPDBContext db = new IFMPDBContext())
         {
             ScoreTask ScoreTask = db.ScoreTask.FirstOrDefault(t => t.ID == ScoreTaskID && t.IsDel != true);
             if (ScoreTask != null)
             {
                 if (ScoreTask.EndDate > DateTime.Now)
                 {
                     string message = "";
                     if (Flag == 1)
                     {
                         //抢单
                         ScoreTaskUser ScoreTaskUser = db.ScoreTaskUser.FirstOrDefault(t => t.ScoreTaskID == ScoreTask.ID && t.UserID == UserID);
                         if (ScoreTaskUser == null)
                         {
                             ScoreTaskUser             = new ScoreTaskUser();
                             ScoreTaskUser.UserID      = UserID;
                             ScoreTaskUser.ScoreTaskID = ScoreTask.ID;
                             db.ScoreTaskUser.Add(ScoreTaskUser);
                             message = "抢单成功";
                         }
                         else
                         {
                             ShowMessage("您已报名");
                             return;
                         }
                     }
                     else if (Flag == 2)
                     {
                         //完成
                         ScoreTaskUser ScoreTaskUser = db.ScoreTaskUser.FirstOrDefault(t => t.ScoreTaskID == ScoreTask.ID && t.UserID == UserID);
                         if (ScoreTaskUser != null)
                         {
                             ScoreTaskUser.CompleteDate = DateTime.Now;
                             //db.ScoreTaskUser.Add(ScoreTaskUser);
                             message = "任务完成成功";
                         }
                         else
                         {
                             ShowMessage("未查询到您的报名信息,请先抢单");
                             return;
                         }
                     }
                     db.SaveChanges();
                     new SysLogDAO().AddLog(LogType.操作日志_添加, message, UserID);
                     ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + message + "');window.parent.location.href='RewardTaskList.aspx'</script>");
                 }
                 else
                 {
                     ShowMessage("任务已过期");
                     return;
                 }
             }
             else
             {
                 ShowMessage("找不到任务");
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
         ShowMessage(ex.Message);
     }
 }