コード例 #1
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);
            }
        }
コード例 #2
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    using (IFMPDBContext db = new IFMPDBContext())
                    {
                        ResourcePath        ResourcePath         = db.ResourcePath.FirstOrDefault(t => t.ID == ResourcePathID);
                        List <ResourcePath> FullResourcePathList = db.ResourcePath.ToList();
                        if (ResourcePath == null)
                        {
                            ResourcePath            = new ResourcePath();
                            ResourcePath.CreateDate = DateTime.Now;
                            ResourcePath.IsDel      = false;
                            ResourcePath.Name       = txt_Name.Text;
                            ResourcePath.ParentID   = ParentPathID;

                            db.ResourcePath.Add(ResourcePath);
                            db.SaveChanges();

                            //在这个位置添加一个文件夹
                            //string path = "../Resource";
                            string subPath = System.Web.HttpContext.Current.Server.MapPath(ResourceDAO.GetPathByPathID(ParentPathID, FullResourcePathList)) + "/" + ResourcePath.Name + "/";
                            if (false == System.IO.Directory.Exists(subPath))
                            {
                                //创建pic文件夹
                                System.IO.Directory.CreateDirectory(subPath);
                            }

                            new SysLogDAO().AddLog(LogType.操作日志_添加, "添加资源路径", UserID);
                        }
                        else
                        {
                            ResourcePath.Name = txt_Name.Text;
                            db.SaveChanges();
                            new SysLogDAO().AddLog(LogType.操作日志_修改, "修改资源路径", UserID);
                        }

                        ShowMessage();

                        ts.Complete();
                    }
                }
                catch (Exception ex)
                {
                    ShowMessage(ex.Message);
                    new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                    ts.Dispose();
                    return;
                }
            }
        }
コード例 #3
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    BaseClass BaseClass = db.BaseClass.FirstOrDefault(t => t.ID == BaseClassID);

                    if (BaseClass == null)
                    {
                        BaseClass                  = new BaseClass();
                        BaseClass.ClassType        = (ClassTypeEnums)Convert.ToInt32(this.ddl_ClassType.SelectedValue);
                        BaseClass.Name             = this.txt_Name.Text;
                        BaseClass.CreateDate       = DateTime.Now;
                        BaseClass.IsDel            = false;
                        BaseClass.ProductionLineID = Convert.ToInt32(this.ddl_ProductionLineID.SelectedValue);
                        if (db.BaseClass.FirstOrDefault(t => t.Name == BaseClass.Name && t.IsDel != true) != null)
                        {
                            ShowMessage("基础班次名称重复");
                            return;
                        }

                        db.BaseClass.Add(BaseClass);
                        ShowMessage();
                        new SysLogDAO().AddLog(LogType.操作日志_添加, "添加基础班次", UserID);
                        db.SaveChanges();
                    }
                    else
                    {
                        BaseClass.ClassType        = (ClassTypeEnums)Convert.ToInt32(this.ddl_ClassType.SelectedValue);
                        BaseClass.Name             = this.txt_Name.Text;
                        BaseClass.ProductionLineID = Convert.ToInt32(this.ddl_ProductionLineID.SelectedValue);

                        if (db.BaseClass.FirstOrDefault(t => t.Name == BaseClass.Name && t.IsDel != true && t.ID != BaseClass.ID) != null)
                        {
                            ShowMessage("基础班次名称重复");
                            return;
                        }
                    }

                    ShowMessage();
                    new SysLogDAO().AddLog(LogType.操作日志_修改, "修改基础班次", UserID);
                    db.SaveChanges();
                }
            }
            catch (Exception error)
            {
                ShowMessage(error.Message);
            }
        }
コード例 #4
0
        public void SaveReviewDetail(HttpContext context)
        {
            try
            {
                int uid = Convert.ToInt32(context.Request.Params["UserID"]);
                //int uid = 1;
                var Review = context.Request.Params["Review"];
                int SpId   = Convert.ToInt32(context.Request.Params["SpId"]);
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    var model = db.SpotProblem.FirstOrDefault(x => x.SpId == SpId);
                    model.ReviewMemo = Review;
                    model.ReviewUser = db.User.FirstOrDefault(x => x.ID == uid).RealName;
                    model.ReviewDate = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                    model.IsreView   = true;
                    db.SaveChanges();
                    sb.Append("{\"result\":\"true\"}");
                }
            }
            catch
            {
                sb.Append("{\"result\":\"false\"}");
            }

            context.Response.Clear();
            context.Response.Write(sb.ToString().TrimEnd(','));
            context.Response.End();
        }
コード例 #5
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();
        }
コード例 #6
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;
            }
        }
コード例 #7
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);
                            db.BaseClassUser.RemoveRange(db.BaseClassUser.Where(t => t.FlowID == selid));
                        }
                        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();
        }
コード例 #8
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.txt_SysID.Text.ToString()))
                {
                    ShowMessage("请至少选择一名人员!!");
                    return;
                }

                using (IFMPDBContext db = new IFMPDBContext())
                {
                    int depid = Convert.ToInt32(ddl_UserType.SelectedValue);
                    foreach (string userid in this.txt_SysID.Text.ToString().TrimEnd(',').Split(','))
                    {
                        int            selid          = Convert.ToInt32(userid);
                        DepartmentUser DepartmentUser = db.DepartmentUser.FirstOrDefault(t => t.UserID == selid && t.DepartmentID == depid);
                        if (DepartmentUser == null)
                        {
                            DepartmentUser = new DepartmentUser();
                            DepartmentUser.DepartmentID = depid;
                            DepartmentUser.UserID       = selid;
                            db.DepartmentUser.Add(DepartmentUser);
                            db.SaveChanges();
                        }
                    }
                    ShowMessage();
                }
            }
            catch (Exception error)
            {
                ShowMessage(error.Message);
            }
        }
コード例 #9
0
 protected void lbtn_Delete_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton  lbtn   = (LinkButton)sender;
         int         id     = Convert.ToInt32(lbtn.CommandArgument);
         TableColumn column = db.TableColumn.FirstOrDefault(t => t.ID == id);
         if (column != null)
         {
             db.TableColumn.Remove(column);
         }
         else
         {
             ShowMessage("删除失败");
             return;
         }
         db.SaveChanges();
         ShowMessage("删除成功");
         DataBindList();
         new SysLogDAO().AddLog(LogType.系统日志, "成功删除字段信息", UserID);
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message);
         new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
         return;
     }
 }
コード例 #10
0
 protected void btn_Delete_Click(object sender, EventArgs e)
 {
     try
     {
         try
         {
             string ids = this.hf_CheckIDS.Value.ToString();
             ids = ids.TrimEnd(',').TrimStart(',');
             foreach (string id in ids.Split(','))
             {
                 int       iid       = Convert.ToInt32(id);
                 Dormitory dormitory = db.Dormitory.FirstOrDefault(t => t.ID == iid);
                 if (dormitory != null)
                 {
                     db.Dormitory.Remove(dormitory);
                 }
             }
             db.SaveChanges();
             new SysLogDAO().AddLog(LogType.操作日志_删除, "成功删除宿舍信息", UserID);
         }
         catch
         {
             ShowMessage("删除失败");
             return;
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message);
         new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
     }
     DataListBind();
     this.hf_CheckIDS.Value = "";
 }
コード例 #11
0
        public void AddResourceData(HttpContext context)
        {
            JObject returnobj = new JObject();
            JArray  jarray    = new JArray();

            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    int    ResourcePathID = Convert.ToInt32(context.Request["pathid"]);
                    string Name           = context.Request["name"];

                    ResourceData ResourceData = new ResourceData();
                    ResourceData.CreateDate     = DateTime.Now;
                    ResourceData.IsDel          = false;
                    ResourceData.Name           = Name;
                    ResourceData.ResourcePathID = ResourcePathID;
                    db.ResourceData.Add(ResourceData);
                    db.SaveChanges();
                    returnobj.Add("result", "success");
                }
            }
            catch
            {
                returnobj.Add("result", "failed");
            }
            context.Response.Clear();
            context.Response.Write(returnobj);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
コード例 #12
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                TaskFlow model = db.TaskFlow.FirstOrDefault(t => t.ID == TaskFlowID);
                if (model != null)
                {
                    if (DateTime.Now > model.EndDate)
                    {
                        model.ApplyType = ApplyTypeEnums.迟交;
                    }
                    else
                    {
                        model.ApplyType = ApplyTypeEnums.正常;
                    }

                    model.AuditMessage = this.txt_AuditMessage.Text.ToString();
                    model.AuditResult  = (AuditResult)Convert.ToInt32(this.rdo_AuditResult.SelectedValue.ToString());
                    model.ApplyDate    = DateTime.Now;
                    db.SaveChanges();

                    ShowMessage();
                    new SysLogDAO().AddLog(LogType.操作日志_其他, "审核" + model.AuditResult + "任务信息", UserID);
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                return;
            }
        }
コード例 #13
0
        /// <summary>
        /// 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            string ids = hf_CheckIDS.Value.ToString();

            try
            {
                ids = ids.TrimEnd(',').TrimStart(',');
                foreach (string id in ids.Split(','))
                {
                    int            iddata = Convert.ToInt32(id);
                    ScoreEventType model  = db.ScoreEventType.FirstOrDefault(t => t.ID == iddata);
                    if (model != null)
                    {
                        model.IsDel = true;
                    }
                    else
                    {
                        ShowMessage("删除失败");
                        return;
                    }
                }
                db.SaveChanges();
                new SysLogDAO().AddLog(LogType.操作日志_删除, "成功删除日常事件类型");
                ShowMessage("删除成功");
                DataBindList();
                this.hf_CheckIDS.Value = "";
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message.ToString());
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message);
            }
        }
コード例 #14
0
        protected void lbtn_ZF_Click(object sender, EventArgs e)
        {
            try
            {
                string ids = this.hf_CheckIDS.Value.TrimEnd(',');
                if (string.IsNullOrEmpty(ids))
                {
                    ShowMessage("请至少选择一条记录");
                    return;
                }

                using (IFMPDBContext db = new IFMPDBContext())
                {
                    foreach (string id in ids.Split(','))
                    {
                        int       selid     = Convert.ToInt32(id);
                        ScoreUser ScoreUser = db.ScoreUser.FirstOrDefault(t => t.ID == selid);
                        ScoreUser.IsDel = true;
                    }

                    db.SaveChanges();
                    new SysLogDAO().AddLog(LogType.操作日志_删除, "作废积分奖扣信息", UserID);
                    ShowMessage("作废奖扣记录成功");
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message.ToString());
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message);
            }
            this.hf_CheckIDS.Value = "";
            DataBindList();
        }
コード例 #15
0
        public void GetGrade(HttpContext context)
        {
            try
            {
                int uid = Convert.ToInt32(context.Request.Params["UserID"]);
                //int uid = 1;
                int SpotScore    = Convert.ToInt32(context.Request.Params["SpotScore"]);
                int DormitorySel = Convert.ToInt32(context.Request.Params["DormitorySel"]);
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    var       user      = db.User.FirstOrDefault(x => x.ID == uid);
                    SpotCheck SpotCheck = new SpotCheck();
                    SpotCheck.SpotScore   = SpotScore;
                    SpotCheck.DormitoryId = DormitorySel;
                    SpotCheck.CreateUser  = user.RealName;
                    SpotCheck.CreateDate  = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                    db.SpotCheck.Add(SpotCheck);
                    db.SaveChanges();
                    var name = "{\"id\":\"" + SpotCheck.SpotId + "\",\"dormitoryid\":\"" + DormitorySel + "\"}";

                    sb.Append("{\"result\":\"true\",\"data\":[");
                    sb.Append(name.TrimEnd(','));
                    sb.Append("]}");
                }
            }
            catch
            {
                sb.Append("{\"result\":\"false\"}");
            }

            context.Response.Clear();
            context.Response.Write(sb.ToString().TrimEnd(','));
            context.Response.End();
        }
コード例 #16
0
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                string ids = this.hf_CheckIDS.Value.ToString();
                ids = ids.TrimEnd(',').TrimStart(',');
                foreach (string id in ids.Split(','))
                {
                    int        selid = Convert.ToInt32(id);
                    Department dep   = db.Department.FirstOrDefault(t => t.ID == selid);

                    if (dep != null)
                    {
                        dep.IsDel = true;
                    }
                    else
                    {
                        ShowMessage("删除失败");
                        return;
                    }
                    db.SaveChanges();
                    ShowMessage("删除成功");
                    new SysLogDAO().AddLog(LogType.操作日志_删除, "删除部门信息", UserID);
                }

                DataBindList();
                this.hf_CheckIDS.Value = "";
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
            }
        }
コード例 #17
0
 protected void btn_Submit_Click(object sender, EventArgs e)
 {
     try
     {
         using (IFMPDBContext db = new IFMPDBContext())
         {
             //这里应该有权限,很重要
             Role Role = db.Role.FirstOrDefault(t => t.ID == RoleID);
             if (Role == null)
             {
                 Role            = new Role();
                 Role.CreateDate = DateTime.Now;
                 Role.IsBase     = false;
                 Role.IsDel      = false;
                 Role.Name       = this.txt_Name.Text;
                 if (db.Role.FirstOrDefault(t => t.Name == Role.Name) != null)
                 {
                     ShowMessage("权限名称重复");
                     return;
                 }
                 db.Role.Add(Role);
                 db.SaveChanges();
                 new SysLogDAO().AddLog(LogType.操作日志_添加, "添加权限", UserID);
             }
             else
             {
                 Role.Name = this.txt_Name.Text;
                 if (db.Role.FirstOrDefault(t => t.Name == Role.Name && t.ID != Role.ID) != null)
                 {
                     ShowMessage("权限名称重复");
                     return;
                 }
                 db.SaveChanges();
                 new SysLogDAO().AddLog(LogType.操作日志_修改, "修改权限", UserID);
             }
             ShowMessage();
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message);
         new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
         return;
     }
 }
コード例 #18
0
        public void SpotProblemAdd(HttpContext context)
        {
            try
            {
                int uid = Convert.ToInt32(context.Request.Params["UserID"]);
                //int uid = 1;
                int SpotScore    = Convert.ToInt32(context.Request.Params["SpotScore"]);
                int DormitorySel = Convert.ToInt32(context.Request.Params["DormitorySel"]);
                var ProDesc      = context.Request.Params["ProDesc"].TrimEnd(',').Split(',');
                var DutyUser     = context.Request.Params["DutyUser"].TrimEnd(',').Split(',');
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    var       user      = db.User.FirstOrDefault(x => x.ID == uid);
                    SpotCheck SpotCheck = new SpotCheck();
                    SpotCheck.SpotScore   = SpotScore;
                    SpotCheck.DormitoryId = DormitorySel;
                    SpotCheck.CreateUser  = user.RealName;
                    SpotCheck.CreateDate  = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                    db.SpotCheck.Add(SpotCheck);
                    db.SaveChanges();
                    for (int i = 0; i < ProDesc.Length; i++)
                    {
                        int         dutyuderid  = int.Parse(DutyUser[i]);
                        SpotProblem SpotProblem = new SpotProblem();
                        SpotProblem.SpotId     = SpotCheck.SpotId;
                        SpotProblem.ProDesc    = ProDesc[i];
                        SpotProblem.DutyUser   = db.User.FirstOrDefault(x => x.ID == dutyuderid).RealName;
                        SpotProblem.CreateUser = db.User.FirstOrDefault(x => x.ID == uid).RealName;
                        SpotProblem.CreateDate = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                        SpotProblem.IsreView   = false;
                        db.SpotProblem.Add(SpotProblem);
                        db.SaveChanges();
                    }
                    sb.Append("{\"result\":\"true\"}");
                }
            }
            catch
            {
                sb.Append("{\"result\":\"false\"}");
            }

            context.Response.Clear();
            context.Response.Write(sb.ToString().TrimEnd(','));
            context.Response.End();
        }
コード例 #19
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                ScoreEvent model = db.ScoreEvent.FirstOrDefault(t => t.ID == SEID && t.IsDel != true);
                if (model == null)
                {
                    model                  = new ScoreEvent();
                    model.Name             = this.txt_EventName.Text.Trim();
                    model.AScore           = 0;
                    model.BScore           = Convert.ToInt32(this.txt_BSCore.Text);
                    model.Content          = this.txt_EventMark.Text.Trim();
                    model.ScoreEventTypeID = Convert.ToInt32(this.ddl_EType.SelectedValue);
                    //model.IsSpecialUserAudit = Convert.ToBoolean(Convert.ToInt32(this.rbl_IsSpecializedUser.SelectedValue));
                    //model.FirstAuditUserID = Convert.ToInt32(this.ddl_FirstAduitUser.SelectedValue);
                    //model.LastAuditUserID = Convert.ToInt32(this.ddl_LastAduitUser.SelectedValue);
                    model.ScoreEventType = (ScoreEventTypeEnum)SFlag;
                    model.CreateUserID   = UserID;
                    model.CreateDate     = DateTime.Now;
                    model.IsDel          = Convert.ToBoolean((int)CommonEnum.Deleted.未删除);
                    if (db.ScoreEvent.FirstOrDefault(t => t.Name == model.Name && t.IsDel == model.IsDel) != null)
                    {
                        ShowMessage("事件名称不能重复");
                        return;
                    }
                    db.ScoreEvent.Add(model);
                }
                else
                {
                    model.Name             = this.txt_EventName.Text.Trim();
                    model.AScore           = 0;
                    model.BScore           = Convert.ToInt32(this.txt_BSCore.Text);
                    model.Content          = this.txt_EventMark.Text.Trim();
                    model.ScoreEventTypeID = Convert.ToInt32(this.ddl_EType.SelectedValue);
                    //model.IsSpecialUserAudit = Convert.ToBoolean(Convert.ToInt32(this.rbl_IsSpecializedUser.SelectedValue));
                    //model.FirstAuditUserID = Convert.ToInt32(this.ddl_FirstAduitUser.SelectedValue);
                    //model.LastAuditUserID = Convert.ToInt32(this.ddl_LastAduitUser.SelectedValue);
                    if (db.ScoreEvent.FirstOrDefault(t => t.Name == model.Name && t.IsDel == model.IsDel && t.ID != model.ID) != null)
                    {
                        ShowMessage("事件名称不能重复");
                        return;
                    }
                }

                db.SaveChanges();
                ShowMessage();
                LogType log = (SEID == 0 ? LogType.操作日志_添加 : LogType.操作日志_修改);
                new SysLogDAO().AddLog(log, (SEID == 0 ? "增加" : "修改") + "名称为" + model.Name + "的事件信息");
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message);
                ShowMessage(ex.Message);
            }
        }
コード例 #20
0
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    LinkButton alter = (LinkButton)sender;   //delete为LinkButton的ID
                    string     data  = alter.CommandArgument;
                    string     type  = data.Split('_')[0];
                    int        id    = Convert.ToInt32(data.Split('_')[1]);
                    if (type == "文件夹")
                    {
                        ResourcePath ResourcePath = db.ResourcePath.FirstOrDefault(t => t.ID == id);
                        ResourcePath.IsDel = true;
                        //将该路径下所有的文件均置为删除
                        //List<ResourceData> ResourceDataList = db.ResourceData.Where(t=>t.ResourcePathID==ResourcePath.ID).ToList();
                        new ResourceDAO().DeleteFullChildren(id);


                        db.SaveChanges();
                    }
                    else if (type == "图片")
                    {
                        ResourceData ResourceData = db.ResourceData.FirstOrDefault(t => t.ID == id);
                        if (ResourceData != null)
                        {
                            ResourceData.IsDel = true;
                            db.SaveChanges();
                        }
                    }
                }
                ShowMessage("删除成功");
                new SysLogDAO().AddLog(LogType.操作日志_删除, "删除资源", UserID);
                DataBindList();
                //this.hf_CheckIDS.Value = "";
            }
            catch (Exception ex)
            {
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                return;
            }
        }
コード例 #21
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    Flow Flow = db.Flow.FirstOrDefault(t => t.ID == ID);
                    if (Flow == null)
                    {
                        Flow             = new Flow();
                        Flow.TableTypeID = TableTypeID;
                        Flow.Name        = txt_FlowName.Text;
                        Flow.ParentID    = Convert.ToInt32(ddl_ParentFlow.SelectedValue);
                        if (rdo_IsAudit.SelectedValue == "1")
                        {
                            Flow.IsAudit = true;
                        }
                        else
                        {
                            Flow.IsAudit = false;
                        }
                        db.Flow.Add(Flow);
                    }
                    else
                    {
                        Flow.TableTypeID = TableTypeID;
                        Flow.Name        = txt_FlowName.Text;
                        Flow.ParentID    = Convert.ToInt32(ddl_ParentFlow.SelectedValue);
                        if (rdo_IsAudit.SelectedValue == "1")
                        {
                            Flow.IsAudit = true;
                        }
                        else
                        {
                            Flow.IsAudit = false;
                        }
                        db.Flow.Add(Flow);
                    }
                    db.SaveChanges();

                    ShowMessage();
                    LogType log = (ID == -1 ? LogType.操作日志_添加 : LogType.操作日志_修改);
                    new SysLogDAO().AddLog(log, (ID == -1 ? "增加" : "修改") + "流程信息");
                    ts.Complete();
                }
                catch (Exception ex)
                {
                    ShowMessage(ex.Message);
                    new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
                    ts.Dispose();
                    return;
                }
            }
        }
コード例 #22
0
        public static string GenerateToken(int userID, DateTime expires, IFMPDBContext db)
        {
            string token = Guid.NewGuid().ToString();
            User   user  = db.User.FirstOrDefault(t => t.ID == userID);

            if (user != null)
            {
                user.Token   = token;
                user.Expires = expires;
                db.SaveChanges();
            }
            return(token);
        }
コード例 #23
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        ProductionLine model = db.ProductionLine.FirstOrDefault(t => t.ID == ID);
                        if (model == null)
                        {
                            model            = new ProductionLine();
                            model.IsDel      = false;
                            model.CreateDate = DateTime.Now;
                            model.Name       = txt_Name.Text;
                            if (db.ProductionLine.FirstOrDefault(t => t.Name == model.Name) != null)
                            {
                                ShowMessage("生产线名称重复");
                                return;
                            }
                            db.ProductionLine.Add(model);
                        }
                        else
                        {
                            if (db.ProductionLine.FirstOrDefault(t => t.Name == model.Name && t.ID != ID) != null)
                            {
                                ShowMessage("生产线名称重复");
                                return;
                            }
                            model.Name = txt_Name.Text;
                        }
                        db.SaveChanges();

                        ShowMessage();
                        LogType log = (ID == -1 ? LogType.操作日志_添加 : LogType.操作日志_修改);
                        new SysLogDAO().AddLog(log, (ID == -1 ? "增加" : "修改") + "生产线信息");
                        ts.Complete();
                    }
                    catch
                    {
                        ShowMessage("提交失败");
                        ts.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
            }
        }
コード例 #24
0
ファイル: IFMPService.cs プロジェクト: wxh1903999894/IFMP
        //这个以天为单位,提醒当天有点检任务
        private void AlarmDormitoryUserNotice()
        {
            using (IFMPDBContext db = new IFMPDBContext())
            {
                try
                {
                    int WeekDay = (int)DateTime.Now.DayOfWeek;
                    List <Scheduling> SchedulingList = db.Scheduling.Where(t => t.Date == (WeekDate)WeekDay).ToList();

                    DateTime BeginDate = DateTime.Now.Date;
                    DateTime EndDate   = DateTime.Now.AddDays(1).Date;


                    List <SpotCheck> SpotCheckList = db.SpotCheck.Where(t => t.CreateDate >= BeginDate &&
                                                                        t.CreateDate < EndDate).ToList();

                    List <User> UserList = db.User.Where(t => t.DDID != null && t.IsDel != true).ToList();
                    //UserList = UserList.Where(t => SpotCheckList.Select(m => m.CreateUser).Contains(t.ID)).ToList();



                    foreach (Scheduling Scheduling in SchedulingList)
                    {
                        foreach (string UserID in Scheduling.CheckName.Split(','))
                        {
                            int SelUserID = Convert.ToInt32(UserID);
                            if (SpotCheckList.FirstOrDefault(t => t.CreateUser == SelUserID) == null)
                            {
                                //发消息
                                User User = UserList.FirstOrDefault(t => t.ID == SelUserID);

                                new NoticeDAO().SendDDRemindNotice(
                                    User.DDID,
                                    "",
                                    "",
                                    DateTime.Now.ToString("yyyyMMdd") + "日工作提醒",
                                    "宿舍点检",
                                    "今日(" + DateTime.Now.ToString("yyyy-MM-dd") + ")需要进行宿舍点检,请去宿舍进行点检",
                                    null);
                            }
                        }
                        //int UserID = Convert.ToInt32(Scheduling.CheckName);
                    }
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    AddNotice("系统服务的工作提醒存在问题:" + ex.Message, db.User.FirstOrDefault(t => t.UserName == "admin").ID, db.User.FirstOrDefault(t => t.UserName == "admin").ID);
                }
            }
        }
コード例 #25
0
 protected void btn_Submit_Click(object sender, EventArgs e)
 {
     try
     {
         using (IFMPDBContext db = new IFMPDBContext())
         {
             string message = "";
             Post   Post    = db.Post.FirstOrDefault(t => t.ID == PostID);
             if (Post == null)
             {
                 Post              = new Post();
                 Post.CreateDate   = DateTime.Now;
                 Post.CreateUserID = UserID;
                 Post.IsDel        = false;
                 Post.Description  = this.txt_Description.Text;
                 Post.Name         = this.txt_Name.Text;
                 if (db.Post.FirstOrDefault(t => t.Name == Post.Name) != null)
                 {
                     ShowMessage("岗位名称已存在,请修改后重新添加");
                     return;
                 }
                 Post.Order = Convert.ToInt32(this.txt_Order.Text);
                 message    = "添加名称为【" + Post.Name + "】的岗位信息";
                 db.Post.Add(Post);
                 new SysLogDAO().AddLog(LogType.操作日志_添加, message, UserID);
             }
             else
             {
                 Post.Description = this.txt_Description.Text;
                 Post.Name        = this.txt_Name.Text;
                 if (db.Post.FirstOrDefault(t => t.Name == Post.Name && t.ID != Post.ID) != null)
                 {
                     ShowMessage("岗位名称已存在,请修改后重新添加");
                     return;
                 }
                 Post.Order = Convert.ToInt32(this.txt_Order.Text);
                 message    = "修改名称为【" + Post.Name + "】的岗位信息";
                 new SysLogDAO().AddLog(LogType.操作日志_修改, message, UserID);
             }
             db.SaveChanges();
             ShowMessage();
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message);
         new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
         return;
     }
 }
コード例 #26
0
        protected void btn_Sumbit_Click(object sender, EventArgs e)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        ScoreAuditUser model = db.ScoreAuditUser.FirstOrDefault(t => t.ID == SUID);
                        if (model == null)
                        {
                            string uids = this.txt_SysID.Text.ToString();
                            uids = uids.TrimEnd(',').TrimStart(',');
                            int uid = -1;
                            foreach (string id in uids.Split(','))
                            {
                                model = new ScoreAuditUser();
                                if (!string.IsNullOrEmpty(id) && int.TryParse(id, out uid))
                                {
                                    model.UserID             = uid;
                                    model.ScoreAuditUserType = (ScoreAuditUserType)Convert.ToInt32(this.ddl_UserType.SelectedValue.ToString());
                                    if (db.ScoreAuditUser.FirstOrDefault(t => t.UserID == model.UserID && t.ScoreAuditUserType == model.ScoreAuditUserType) != null)
                                    {
                                        ShowMessage("当前信息重复,请检查后重新添加");
                                        return;
                                    }
                                    db.ScoreAuditUser.Add(model);
                                }
                            }
                        }
                        db.SaveChanges();

                        ShowMessage();
                        LogType log = (SUID == -1 ? LogType.操作日志_添加 : LogType.操作日志_修改);
                        new SysLogDAO().AddLog(log, (SUID == -1 ? "增加" : "修改") + "审核人员信息");
                        ts.Complete();
                    }
                    catch
                    {
                        ShowMessage("提交失败");
                        ts.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
            }
        }
コード例 #27
0
ファイル: IFMPService.cs プロジェクト: wxh1903999894/IFMP
 public void AddNotice(string message, int ReciveUserID, int SendUserID, NoticeType NoticeType = NoticeType.系统通知)
 {
     using (IFMPDBContext db = new IFMPDBContext())
     {
         Notice Notice = new Notice();
         Notice.Contenet     = "【" + Enum.GetName(typeof(NoticeType), NoticeType) + "】" + message;
         Notice.IsSend       = false;
         Notice.NoticeType   = NoticeType;
         Notice.ReciveUserID = ReciveUserID;
         Notice.SendDate     = DateTime.Now;
         Notice.SendUserID   = SendUserID;
         db.Notice.Add(Notice);
         db.SaveChanges();
     }
 }
コード例 #28
0
        public void AddDepartment(JObject data, Department department, string accesstoken)
        {
            string url = string.Format("https://oapi.dingtalk.com/department/create?access_token={0}", accesstoken);

            using (IFMPDBContext db = new IFMPDBContext())
            {
                JObject GetData = new JObject();
                GetData.Add("name", department.Name);
                GetData.Add("parentid", department.ParentID == -1 ? 1 : db.Department.FirstOrDefault(t => t.ID == department.ParentID).DingID);
                JObject ReturnData = PostData(url, GetData);
                int     dingid     = Convert.ToInt32(ReturnData["id"]);
                department.DingID = dingid;
                db.SaveChanges();
            }
        }
コード例 #29
0
ファイル: BaseData.ashx.cs プロジェクト: wxh1903999894/IFMP
        public void BuildBaseClassUser(HttpContext context)
        {
            JObject returnobj = new JObject();
            JArray  jarray    = new JArray();

            try
            {
                //int TableTypeID = Convert.ToInt32(context.Request["tabletype"]);
                int    BaseClassID   = Convert.ToInt32(context.Request["baseclassid"]);
                JArray FlowUserArray = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(context.Request["flowuser"]);
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    BaseClass BaseClass = db.BaseClass.FirstOrDefault(t => t.ID == BaseClassID);
                    if (BaseClass != null)
                    {
                        foreach (JObject FlowUserObject in FlowUserArray)
                        {
                            int flowid = Convert.ToInt32(FlowUserObject["ID"]);
                            //删除原有的
                            db.BaseClassUser.RemoveRange(db.BaseClassUser.Where(t => t.BaseClassID == BaseClass.ID && t.FlowID == flowid));

                            foreach (object User in FlowUserObject["UserList"])
                            {
                                BaseClassUser BaseClassUser = new BaseClassUser();
                                BaseClassUser.BaseClassID = BaseClass.ID;
                                BaseClassUser.FlowID      = flowid;
                                BaseClassUser.UserID      = Convert.ToInt32(User);
                                db.BaseClassUser.Add(BaseClassUser);
                            }
                        }
                        db.SaveChanges();

                        returnobj.Add("result", "success");
                    }
                    else
                    {
                        returnobj.Add("result", "failed");
                    }
                }
            }
            catch
            {
                returnobj.Add("result", "failed");
            }
            context.Response.Clear();
            context.Response.Write(returnobj);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
コード例 #30
0
        protected void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                string ids = this.hf_CheckIDS.Value.ToString();
                ids = ids.TrimEnd(',').TrimStart(',');
                using (IFMPDBContext db = new IFMPDBContext())
                {
                    foreach (string id in ids.Split(','))
                    {
                        int selid = Convert.ToInt32(id);

                        Role Role = db.Role.FirstOrDefault(t => t.ID == selid);
                        if (Role != null)
                        {
                            if (Role.IsBase)
                            {
                                ShowMessage("基础权限无法删除");
                                return;
                            }
                            else
                            {
                                Role.IsDel = true;
                            }
                        }
                        else
                        {
                            ShowMessage("删除失败");
                            return;
                        }

                        db.SaveChanges();
                        ShowMessage("删除成功");
                        new SysLogDAO().AddLog(LogType.操作日志_删除, "删除权限", UserID);
                    }
                }

                DataBindList();
                this.hf_CheckIDS.Value = "";
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
                new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID);
            }
        }