示例#1
0
        /// <summary>
        /// 保存TestPlan
        /// </summary>
        /// <param name="getTestPlan">考试计划记录</param>
        public static string SaveTestPlan(Model.TestPlanItem getTestPlan)
        {
            string alterStr = string.Empty;

            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                Model.Training_TestPlan newTestPlan = new Model.Training_TestPlan
                {
                    TestPlanId = getTestPlan.TestPlanId,
                    ProjectId  = getTestPlan.ProjectId,
                    PlanCode   = getTestPlan.TestPlanCode,
                    PlanName   = getTestPlan.TestPlanName,
                    PlanManId  = getTestPlan.TestPlanManId,
                    //PlanDate= getTestPlan.TestPlanDate,
                    TestStartTime = Funs.GetNewDateTimeOrNow(getTestPlan.TestStartTime),
                    TestEndTime   = Funs.GetNewDateTimeOrNow(getTestPlan.TestEndTime),
                    Duration      = getTestPlan.Duration,
                    SValue        = getTestPlan.SValue,
                    MValue        = getTestPlan.MValue,
                    JValue        = getTestPlan.JValue,
                    TotalScore    = getTestPlan.TotalScore,
                    QuestionCount = getTestPlan.QuestionCount,
                    TestPalce     = getTestPlan.TestPalce,
                    UnitIds       = getTestPlan.UnitIds,
                    WorkPostIds   = getTestPlan.WorkPostIds,
                    States        = getTestPlan.States,
                    PlanDate      = DateTime.Now,
                };

                if (!string.IsNullOrEmpty(getTestPlan.TrainingPlanId))
                {
                    newTestPlan.PlanId = getTestPlan.TrainingPlanId;
                }
                var isUpdate = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == newTestPlan.TestPlanId);
                if (isUpdate == null)
                {
                    string unitId = string.Empty;
                    var    user   = db.Sys_User.FirstOrDefault(e => e.UserId == newTestPlan.PlanManId);
                    if (user != null)
                    {
                        unitId = user.UnitId;
                    }
                    newTestPlan.PlanCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, unitId);
                    if (string.IsNullOrEmpty(newTestPlan.TestPlanId))
                    {
                        newTestPlan.TestPlanId = SQLHelper.GetNewID();
                    }

                    db.Training_TestPlan.InsertOnSubmit(newTestPlan);
                    db.SubmitChanges();

                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, newTestPlan.TestPlanId, newTestPlan.PlanDate);
                }
                else
                {
                    isUpdate.States = newTestPlan.States;
                    if (isUpdate.States == "0" || isUpdate.States == "1")
                    {
                        isUpdate.PlanName      = newTestPlan.PlanName;
                        isUpdate.PlanManId     = newTestPlan.PlanManId;
                        isUpdate.PlanDate      = newTestPlan.PlanDate;
                        isUpdate.TestStartTime = newTestPlan.TestStartTime;
                        isUpdate.TestEndTime   = newTestPlan.TestEndTime;
                        isUpdate.Duration      = newTestPlan.Duration;
                        isUpdate.TotalScore    = newTestPlan.TotalScore;
                        isUpdate.QuestionCount = newTestPlan.QuestionCount;
                        isUpdate.TestPalce     = newTestPlan.TestPalce;
                        isUpdate.UnitIds       = newTestPlan.UnitIds;
                        isUpdate.WorkPostIds   = newTestPlan.WorkPostIds;
                        ////删除 考生记录
                        var deleteRecords = from x in db.Training_TestRecord
                                            where x.TestPlanId == isUpdate.TestPlanId
                                            select x;
                        if (deleteRecords.Count() > 0)
                        {
                            foreach (var item in deleteRecords)
                            {
                                var testRecordItem = from x in db.Training_TestRecordItem
                                                     where x.TestRecordId == item.TestRecordId
                                                     select x;
                                if (testRecordItem.Count() > 0)
                                {
                                    db.Training_TestRecordItem.DeleteAllOnSubmit(testRecordItem);
                                    db.SubmitChanges();
                                }
                            }

                            db.Training_TestRecord.DeleteAllOnSubmit(deleteRecords);
                            db.SubmitChanges();
                        }

                        ////删除 考试题目类型
                        var deleteTestPlanTrainings = from x in db.Training_TestPlanTraining where x.TestPlanId == isUpdate.TestPlanId select x;
                        if (deleteTestPlanTrainings.Count() > 0)
                        {
                            db.Training_TestPlanTraining.DeleteAllOnSubmit(deleteTestPlanTrainings);
                            db.SubmitChanges();
                        }
                    }
                    else if (isUpdate.States == "3") ////考试状态3时 更新培训计划状态 把培训计划写入培训记录中
                    {
                        DateTime?endTime = Funs.GetNewDateTime(getTestPlan.TestEndTime);
                        ////判断是否有未考完的考生
                        var getTrainingTestRecords = db.Training_TestRecord.FirstOrDefault(x => x.TestPlanId == isUpdate.TestPlanId &&
                                                                                           (!x.TestStartTime.HasValue || ((!x.TestEndTime.HasValue || !x.TestScores.HasValue) && x.TestStartTime.Value.AddMinutes(isUpdate.Duration) >= DateTime.Now)));
                        if (getTrainingTestRecords != null && endTime.HasValue && endTime.Value.AddMinutes(isUpdate.Duration) < DateTime.Now)
                        {
                            alterStr        = "当前存在未交卷考生,不能提前结束考试!";
                            isUpdate.States = "2";
                        }
                        else
                        {
                            SubmitTest(isUpdate);
                        }
                    }
                    else if (newTestPlan.States == "2") ////开始考试 只更新考试计划状态为考试中。
                    {
                        if (isUpdate.TestStartTime > DateTime.Now)
                        {
                            isUpdate.States = "1";
                            alterStr        = "未到考试扫码开始时间,不能开始考试!";
                        }
                    }
                    if (string.IsNullOrEmpty(alterStr))
                    {
                        db.SubmitChanges();
                    }
                }

                if (newTestPlan.States == "0" || newTestPlan.States == "1")
                {
                    if (getTestPlan.TestRecordItems.Count() > 0)
                    {
                        ////新增考试人员明细
                        foreach (var item in getTestPlan.TestRecordItems)
                        {
                            var person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == item.TestManId);
                            if (person != null)
                            {
                                Model.Training_TestRecord newTrainDetail = new Model.Training_TestRecord
                                {
                                    TestRecordId = SQLHelper.GetNewID(),
                                    ProjectId    = newTestPlan.ProjectId,
                                    TestPlanId   = newTestPlan.TestPlanId,
                                    TestManId    = item.TestManId,
                                    TestType     = item.TestType,
                                    Duration     = newTestPlan.Duration,
                                };
                                db.Training_TestRecord.InsertOnSubmit(newTrainDetail);
                                db.SubmitChanges();
                            }
                        }
                    }
                    if (getTestPlan.TestPlanTrainingItems.Count() > 0)
                    {
                        foreach (var item in getTestPlan.TestPlanTrainingItems)
                        {
                            var trainingType = TestTrainingService.GetTestTrainingById(item.TrainingTypeId);
                            if (trainingType != null)
                            {
                                Model.Training_TestPlanTraining newPlanItem = new Model.Training_TestPlanTraining
                                {
                                    TestPlanTrainingId = SQLHelper.GetNewID(),
                                    TestPlanId         = newTestPlan.TestPlanId,
                                    TrainingId         = item.TrainingTypeId,
                                    TestType1Count     = item.TestType1Count,
                                    TestType2Count     = item.TestType2Count,
                                    TestType3Count     = item.TestType3Count,
                                };

                                db.Training_TestPlanTraining.InsertOnSubmit(newPlanItem);
                                db.SubmitChanges();
                            }
                        }
                    }
                }
            }
            return(alterStr);
        }
示例#2
0
        /// <summary>
        /// 获取用户下拉选项  项目 角色 且可审批
        /// </summary>
        /// <returns></returns>
        public static List <Model.SpSysUserItem> GetProjectRoleUserListByProjectId(string projectId, string unitId)
        {
            IQueryable <Model.SpSysUserItem> users = null;

            if (!string.IsNullOrEmpty(projectId))
            {
                List <Model.SpSysUserItem>       returUsers = new List <Model.SpSysUserItem>();
                List <Model.Project_ProjectUser> getPUser   = new List <Model.Project_ProjectUser>();
                if (!string.IsNullOrEmpty(unitId))
                {
                    getPUser = (from x in Funs.DB.Project_ProjectUser
                                join u in Funs.DB.Project_ProjectUnit on new { x.ProjectId, x.UnitId } equals new { u.ProjectId, u.UnitId }
                                where x.ProjectId == projectId && (u.UnitId == unitId || u.UnitType == BLL.Const.ProjectUnitType_1 || u.UnitType == BLL.Const.ProjectUnitType_3 || u.UnitType == BLL.Const.ProjectUnitType_4)
                                select x).ToList();
                }
                else
                {
                    getPUser = (from x in Funs.DB.Project_ProjectUser
                                where x.ProjectId == projectId
                                select x).ToList();
                }

                if (getPUser.Count() > 0)
                {
                    foreach (var item in getPUser)
                    {
                        List <string> roleIdList = Funs.GetStrListByStr(item.RoleId, ',');
                        var           getRoles   = Funs.DB.Sys_Role.FirstOrDefault(x => x.IsAuditFlow == true && roleIdList.Contains(x.RoleId));
                        if (getRoles != null)
                        {
                            string userName = RoleService.getRoleNamesRoleIds(item.RoleId) + "-" + UserService.GetUserNameByUserId(item.UserId);
                            Model.SpSysUserItem newsysUser = new Model.SpSysUserItem
                            {
                                UserId   = item.UserId,
                                UserName = userName,
                            };
                            returUsers.Add(newsysUser);
                        }
                    }
                }
                return(returUsers);
            }
            else
            {
                if (!string.IsNullOrEmpty(unitId))
                {
                    users = (from x in Funs.DB.Sys_User
                             join z in Funs.DB.Sys_Role on x.RoleId equals z.RoleId
                             where x.IsPost == true && z.IsAuditFlow == true && x.UnitId == unitId
                             orderby x.UserCode
                             select new Model.SpSysUserItem
                    {
                        UserName = z.RoleName + "- " + x.UserName,
                        UserId = x.UserId,
                    });
                }
                else
                {
                    users = (from x in Funs.DB.Sys_User
                             join z in Funs.DB.Sys_Role on x.RoleId equals z.RoleId
                             where x.IsPost == true && z.IsAuditFlow == true
                             orderby x.UserCode
                             select new Model.SpSysUserItem
                    {
                        UserName = z.RoleName + "- " + x.UserName,
                        UserId = x.UserId,
                    });
                }
            }
            return(users.ToList());
        }
示例#3
0
        /// <summary>
        /// 增加人员信息
        /// </summary>
        /// <param name="person">人员实体</param>
        public static void AddPerson(Model.SitePerson_Person person)
        {
            Model.SUBHSSEDB         db        = Funs.DB;
            Model.SitePerson_Person newPerson = new Model.SitePerson_Person
            {
                PersonId     = person.PersonId,
                CardNo       = person.CardNo,
                PersonName   = person.PersonName,
                Sex          = person.Sex,
                IdentityCard = person.IdentityCard,
                Address      = person.Address,
                ProjectId    = person.ProjectId,
                UnitId       = person.UnitId,
                TeamGroupId  = person.TeamGroupId,
                WorkAreaId   = person.WorkAreaId,
                WorkPostId   = person.WorkPostId,
                OutTime      = person.OutTime,
                OutResult    = person.OutResult,
                Telephone    = person.Telephone,
                PositionId   = person.PositionId,
                PostTitleId  = person.PostTitleId,
                PhotoUrl     = person.PhotoUrl,
                IsUsed       = person.IsUsed,
                IsCardUsed   = person.IsCardUsed,
                DepartId     = person.DepartId,
                FromPersonId = person.FromPersonId,
                Password     = GetPersonPassWord(person.IdentityCard),
                AuditorId    = person.AuditorId,
                AuditorDate  = person.AuditorDate,
                IsForeign    = person.IsForeign,
                IsOutside    = person.IsOutside,
                Isprint      = "0",
            };

            if (person.InTime.HasValue)
            {
                newPerson.InTime = person.InTime;
            }
            else
            {
                newPerson.InTime = Funs.GetNewDateTime(DateTime.Now.ToShortDateString());
            }

            db.SitePerson_Person.InsertOnSubmit(newPerson);
            db.SubmitChanges();
            if (!CommonService.GetIsThisUnit(Const.UnitId_SEDIN))
            {
                ///写入人员出入场时间表
                Model.SitePerson_PersonInOut newPersonInOut = new Model.SitePerson_PersonInOut
                {
                    ProjectId = person.ProjectId,
                    UnitId    = person.UnitId,
                    PersonId  = person.PersonId
                };

                if (newPerson.InTime.HasValue)
                {
                    newPersonInOut.ChangeTime = person.InTime;
                    newPersonInOut.IsIn       = true;
                    BLL.PersonInOutService.AddPersonInOut(newPersonInOut);
                }

                if (newPerson.OutTime.HasValue)
                {
                    newPersonInOut.ChangeTime = person.OutTime;
                    newPersonInOut.IsIn       = false;
                    BLL.PersonInOutService.AddPersonInOut(newPersonInOut);
                }
            }
            ////增加一条编码记录
            BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.PersonListMenuId, person.ProjectId, person.UnitId, person.PersonId, person.InTime);
        }
示例#4
0
        /// <summary>
        /// 获取当前人是否具有按钮操作权限
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="menuId">按钮id</param>
        /// <param name="buttonName">按钮名称</param>
        /// <returns>是否具有权限</returns>
        public static bool GetAllButtonPowerList(string projectId, string userId, string menuId, string buttonName)
        {
            Model.SUBHSSEDB db      = Funs.DB;
            bool            isPower = false; ////定义是否具备按钮权限

            if (userId == Const.sedinId)
            {
                return(isPower);
            }
            if (!isPower && (userId == Const.sysglyId || userId == Const.hfnbdId))
            {
                isPower = true;
            }
            // 根据角色判断是否有按钮权限
            if (!isPower)
            {
                if (string.IsNullOrEmpty(projectId))
                {
                    var user = UserService.GetUserByUserId(userId); ////用户
                    if (user != null)
                    {
                        if (!string.IsNullOrEmpty(user.RoleId))
                        {
                            var buttonToMenu = from x in db.Sys_ButtonToMenu
                                               join y in db.Sys_ButtonPower on x.ButtonToMenuId equals y.ButtonToMenuId
                                               join z in db.Sys_Menu on x.MenuId equals z.MenuId
                                               where y.RoleId == user.RoleId && y.MenuId == menuId &&
                                               x.ButtonName == buttonName && x.MenuId == menuId
                                               select x;
                            if (buttonToMenu.Count() > 0)
                            {
                                isPower = true;
                            }
                        }
                    }
                }
                else
                {
                    var pUser = BLL.ProjectUserService.GetProjectUserByUserIdProjectId(projectId, userId); ///项目用户
                    if (pUser != null)
                    {
                        if (!string.IsNullOrEmpty(pUser.RoleId))
                        {
                            List <string> roleIdList   = Funs.GetStrListByStr(pUser.RoleId, ',');
                            var           buttonToMenu = from x in db.Sys_ButtonToMenu
                                                         join y in db.Sys_ButtonPower on x.ButtonToMenuId equals y.ButtonToMenuId
                                                         join z in db.Sys_Menu on x.MenuId equals z.MenuId
                                                         where roleIdList.Contains(y.RoleId) && y.MenuId == menuId &&
                                                         x.ButtonName == buttonName && x.MenuId == menuId
                                                         select x;
                            if (buttonToMenu.Count() > 0)
                            {
                                isPower = true;
                            }
                        }
                    }
                }
            }

            if (isPower && !String.IsNullOrEmpty(projectId) && menuId != BLL.Const.ProjectShutdownMenuId)
            {
                var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
                if (porject != null && (porject.ProjectState == BLL.Const.ProjectState_2 || porject.ProjectState == BLL.Const.ProjectState_3))
                {
                    isPower = false;
                }
            }
            if (!CommonService.GetIsBuildUnit())
            {
                var menu = BLL.SysMenuService.GetSysMenuByMenuId(menuId);
                if (menu != null && menu.MenuType == BLL.Const.Menu_Resource)
                {
                    if (buttonName == BLL.Const.BtnSaveUp || buttonName == BLL.Const.BtnUploadResources || buttonName == BLL.Const.BtnAuditing)
                    {
                        isPower = false;
                    }
                }
            }
            return(isPower);
        }
示例#5
0
        /// <summary>
        /// 保存RectifyNotices
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public static void SaveRectifyNotices(Model.RectifyNoticesItem rectifyNotices)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                bool insertRectifyNoticesItemItem            = false;
                Model.Check_RectifyNotices newRectifyNotices = new Model.Check_RectifyNotices
                {
                    RectifyNoticesId   = rectifyNotices.RectifyNoticesId,
                    ProjectId          = rectifyNotices.ProjectId,
                    RectifyNoticesCode = rectifyNotices.RectifyNoticesCode,
                    UnitId             = rectifyNotices.UnitId,
                    CheckManNames      = rectifyNotices.CheckManNames,
                    CheckManIds        = rectifyNotices.CheckManIds,
                    CheckedDate        = Funs.GetNewDateTime(rectifyNotices.CheckedDate),
                    HiddenHazardType   = rectifyNotices.HiddenHazardType,
                    States             = rectifyNotices.States,
                };
                if (!string.IsNullOrEmpty(rectifyNotices.WorkAreaId))
                {
                    newRectifyNotices.WorkAreaId = rectifyNotices.WorkAreaId;
                }
                if (!string.IsNullOrEmpty(rectifyNotices.CompleteManId))
                {
                    newRectifyNotices.CompleteManId = rectifyNotices.CompleteManId;
                }
                if (newRectifyNotices.States == Const.State_1)
                {
                    newRectifyNotices.SignPerson = rectifyNotices.SignPersonId;
                }
                //// 新增整改单
                var isUpdate = db.Check_RectifyNotices.FirstOrDefault(x => x.RectifyNoticesId == newRectifyNotices.RectifyNoticesId);
                if (isUpdate == null)
                {
                    newRectifyNotices.RectifyNoticesId   = SQLHelper.GetNewID();
                    newRectifyNotices.Isprint            = "0";
                    newRectifyNotices.Isprintf           = "0";
                    newRectifyNotices.RectifyNoticesCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId);
                    db.Check_RectifyNotices.InsertOnSubmit(newRectifyNotices);
                    db.SubmitChanges();
                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId, newRectifyNotices.RectifyNoticesId, newRectifyNotices.CheckedDate);
                    //// 整改单附件
                    if (!string.IsNullOrEmpty(rectifyNotices.BeAttachUrl))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId + "#0", rectifyNotices.BeAttachUrl, "0");
                    }
                    //// 反馈单附件
                    if (!string.IsNullOrEmpty(rectifyNotices.AfAttachUrl))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId + "#1", rectifyNotices.AfAttachUrl, "0");
                    }
                    //// 整个单据附件
                    if (!string.IsNullOrEmpty(rectifyNotices.AttachUrl))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId, rectifyNotices.AttachUrl, "0");
                    }
                    insertRectifyNoticesItemItem = true;

                    //// 回写巡检记录表
                    if (!string.IsNullOrEmpty(rectifyNotices.HazardRegisterId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(rectifyNotices.HazardRegisterId, ',');
                        foreach (var item in listIds)
                        {
                            var getHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == item);
                            if (getHazardRegister != null)
                            {
                                getHazardRegister.States      = "3";
                                getHazardRegister.HandleIdea += "已升级为隐患整改单:" + newRectifyNotices.RectifyNoticesCode;
                                getHazardRegister.ResultId    = newRectifyNotices.RectifyNoticesId;
                                getHazardRegister.ResultType  = "1";
                                db.SubmitChanges();
                            }
                        }
                    }
                    //// 回写专项检查明细表
                    if (!string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(rectifyNotices.CheckSpecialDetailId, ',');
                        foreach (var item in listIds)
                        {
                            var getCheckSpecialDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == item);
                            if (getCheckSpecialDetail != null)
                            {
                                getCheckSpecialDetail.DataType = "1";
                                getCheckSpecialDetail.DataId   = newRectifyNotices.RectifyNoticesId;
                                db.SubmitChanges();
                            }
                        }
                    }
                }
                else
                {
                    newRectifyNotices.RectifyNoticesId = isUpdate.RectifyNoticesId;
                    isUpdate.States = rectifyNotices.States;
                    if (newRectifyNotices.States == "0" || newRectifyNotices.States == "1")  ////编制人 修改或提交
                    {
                        isUpdate.UnitId           = rectifyNotices.UnitId;
                        isUpdate.WorkAreaId       = rectifyNotices.WorkAreaId;
                        isUpdate.CheckManNames    = rectifyNotices.CheckManNames;
                        isUpdate.CheckManIds      = rectifyNotices.CheckManIds;
                        isUpdate.CheckedDate      = Funs.GetNewDateTime(rectifyNotices.CheckedDate);
                        isUpdate.HiddenHazardType = rectifyNotices.HiddenHazardType;
                        if (newRectifyNotices.States == "1" && !string.IsNullOrEmpty(rectifyNotices.SignPersonId))
                        {
                            isUpdate.SignPerson = rectifyNotices.SignPersonId;
                        }
                        else
                        {
                            newRectifyNotices.States = isUpdate.States = "0";
                        }
                        db.SubmitChanges();
                        //// 删除明细表
                        var deleteItem = from x in db.Check_RectifyNoticesItem where x.RectifyNoticesId == isUpdate.RectifyNoticesId select x;
                        if (deleteItem.Count() > 0)
                        {
                            foreach (var cdeleteItem in deleteItem)
                            {
                                CommonService.DeleteAttachFileById(cdeleteItem.RectifyNoticesItemId);
                            }
                            db.Check_RectifyNoticesItem.DeleteAllOnSubmit(deleteItem);
                        }

                        insertRectifyNoticesItemItem = true;
                    }
                    else if (newRectifyNotices.States == "2") ////总包单位项目安全经理 审核
                    {
                        /// 不同意 打回 同意抄送专业工程师、施工经理、项目经理 并下发分包接收人(也就是施工单位项目安全经理)
                        if (rectifyNotices.IsAgree == false)
                        {
                            newRectifyNotices.States = isUpdate.States = "0";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(rectifyNotices.ProfessionalEngineerId))
                            {
                                isUpdate.ProfessionalEngineerId = rectifyNotices.ProfessionalEngineerId;
                            }
                            if (!string.IsNullOrEmpty(rectifyNotices.ConstructionManagerId))
                            {
                                isUpdate.ConstructionManagerId = rectifyNotices.ConstructionManagerId;
                            }
                            if (!string.IsNullOrEmpty(rectifyNotices.ProjectManagerId))
                            {
                                isUpdate.ProjectManagerId = rectifyNotices.ProjectManagerId;
                            }
                            if (!string.IsNullOrEmpty(rectifyNotices.DutyPersonId))
                            {
                                isUpdate.DutyPersonId = rectifyNotices.DutyPersonId;
                                isUpdate.SignDate     = DateTime.Now;
                            }
                            else
                            {
                                newRectifyNotices.States = isUpdate.States = "1";
                            }
                        }
                        db.SubmitChanges();
                    }
                    else if (newRectifyNotices.States == "3") /// 施工单位项目安全经理 整改 提交施工单位项目负责人
                    {
                        //// 整改明细反馈
                        if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0)
                        {
                            foreach (var rItem in rectifyNotices.RectifyNoticesItemItem)
                            {
                                var getUpdateItem = db.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId);
                                if (getUpdateItem != null)
                                {
                                    getUpdateItem.RectifyResults = rItem.RectifyResults;
                                    if (getUpdateItem.IsRectify != true)
                                    {
                                        getUpdateItem.IsRectify = null;
                                    }
                                    db.SubmitChanges();
                                }
                                if (!string.IsNullOrEmpty(rItem.PhotoAfterUrl))
                                {
                                    APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, rItem.RectifyNoticesItemId + "#2", rItem.PhotoAfterUrl, "0");
                                }
                            }
                        }

                        if (!string.IsNullOrEmpty(rectifyNotices.UnitHeadManId))
                        {
                            isUpdate.UnitHeadManId = rectifyNotices.UnitHeadManId;
                            isUpdate.CompleteDate  = DateTime.Now;
                        }
                        else
                        {
                            newRectifyNotices.States = isUpdate.States = "2";
                        }
                        db.SubmitChanges();
                    }
                    else if (newRectifyNotices.States == "4")
                    { /// 施工单位项目负责人不同意 打回施工单位项目安全经理,同意提交安全经理/安全工程师复查
                        if (rectifyNotices.IsAgree == false)
                        {
                            newRectifyNotices.States = isUpdate.States = "2";
                            isUpdate.CompleteDate    = null;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(rectifyNotices.CheckPersonId))
                            {
                                isUpdate.UnitHeadManDate = DateTime.Now;
                                isUpdate.CheckPerson     = rectifyNotices.CheckPersonId;
                            }
                            else
                            {
                                newRectifyNotices.States = isUpdate.States = "3";
                            }
                        }
                        db.SubmitChanges();
                    }
                    else if (newRectifyNotices.States == "5")
                    {
                        //// 整改明细反馈 复查 是否合格
                        if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0)
                        {
                            foreach (var rItem in rectifyNotices.RectifyNoticesItemItem)
                            {
                                var getUpdateItem = db.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId);
                                if (getUpdateItem != null)
                                {
                                    getUpdateItem.IsRectify = rItem.IsRectify;
                                    db.SubmitChanges();
                                    //// 存在不合格  意见自动不同意
                                    if (!getUpdateItem.IsRectify.HasValue || getUpdateItem.IsRectify == false)
                                    {
                                        rectifyNotices.IsAgree = false;
                                    }
                                }
                            }
                        }

                        ////安全经理/安全工程师 同意关闭,不同意打回施工单位项目安全经理
                        isUpdate.ReCheckOpinion = rectifyNotices.ReCheckOpinion;
                        if (rectifyNotices.IsAgree == false)
                        {
                            newRectifyNotices.States           = isUpdate.States = "2";
                            isUpdate.UnitHeadManDate           = null;
                            isUpdate.CompleteDate              = null;
                            isUpdate.ProfessionalEngineerTime2 = null;
                            isUpdate.ConstructionManagerTime2  = null;
                            isUpdate.ProjectManagerTime2       = null;
                        }
                        else
                        {
                            isUpdate.ReCheckDate = DateTime.Now;
                            //// 回写专项检查明细表
                            var getcheck = from x in db.Check_CheckSpecialDetail where x.DataId == isUpdate.RectifyNoticesId select x;
                            if (getcheck.Count() > 0)
                            {
                                foreach (var item in getcheck)
                                {
                                    item.CompleteStatus = true;
                                    item.CompletedDate  = DateTime.Now;
                                    db.SubmitChanges();
                                }
                            }
                        }
                        db.SubmitChanges();
                    }
                }
                if (insertRectifyNoticesItemItem)
                {
                    //// 新增明细
                    if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0)
                    {
                        foreach (var rItem in rectifyNotices.RectifyNoticesItemItem)
                        {
                            Model.Check_RectifyNoticesItem newItem = new Model.Check_RectifyNoticesItem
                            {
                                RectifyNoticesItemId = SQLHelper.GetNewID(),
                                RectifyNoticesId     = newRectifyNotices.RectifyNoticesId,
                                WrongContent         = rItem.WrongContent,
                                Requirement          = rItem.Requirement,
                                LimitTime            = Funs.GetNewDateTime(rItem.LimitTime),
                                RectifyResults       = null,
                                IsRectify            = null,
                            };
                            db.Check_RectifyNoticesItem.InsertOnSubmit(newItem);
                            db.SubmitChanges();

                            if (!string.IsNullOrEmpty(rItem.PhotoBeforeUrl))
                            {
                                APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newItem.RectifyNoticesItemId + "#1", rItem.PhotoBeforeUrl, "0");
                            }
                        }
                    }
                }
                //// 增加审核记录
                if (rectifyNotices.RectifyNoticesFlowOperateItem != null && rectifyNotices.RectifyNoticesFlowOperateItem.Count() > 0)
                {
                    var getOperate = rectifyNotices.RectifyNoticesFlowOperateItem.FirstOrDefault();
                    if (getOperate != null && !string.IsNullOrEmpty(getOperate.OperateManId))
                    {
                        Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate
                        {
                            FlowOperateId    = SQLHelper.GetNewID(),
                            RectifyNoticesId = newRectifyNotices.RectifyNoticesId,
                            OperateName      = getOperate.OperateName,
                            OperateManId     = getOperate.OperateManId,
                            OperateTime      = DateTime.Now,
                            IsAgree          = getOperate.IsAgree,
                            Opinion          = getOperate.Opinion,
                        };
                        db.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem);
                        db.SubmitChanges();
                    }
                }

                if (newRectifyNotices.States == Const.State_1)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.SignPerson, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您签发", rectifyNotices.CheckManNames, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
                else if (newRectifyNotices.States == Const.State_2)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.DutyPersonId, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您整改", rectifyNotices.SignPersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
                else if (newRectifyNotices.States == Const.State_3)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.UnitHeadManId, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您审核", rectifyNotices.DutyPersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
                else if (newRectifyNotices.States == Const.State_4)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.CheckPerson, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您复查", rectifyNotices.UnitHeadManName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
            }
        }
示例#6
0
        /// <summary>
        /// 插入培训人员 3
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="arr"></param>
        public static bool AddTrainRecordPerson(string projectId, JArray arr, Model.Sys_User user)
        {
            Model.SUBHSSEDB db   = Funs.DB;
            bool            isOk = true;

            try
            {
                foreach (var item in arr)
                {
                    string trainingId     = null; ////培训记录ID
                    var    getTrainRecord = db.EduTrain_TrainRecord.FirstOrDefault(x => x.FromRecordId == item["RecordId"].ToString());
                    if (getTrainRecord != null)
                    {
                        trainingId = getTrainRecord.TrainingId;
                    }

                    string personId  = null; ///人员信息ID
                    var    getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == item["IdentifyId"].ToString());
                    if (getPerson != null)
                    {
                        personId = getPerson.PersonId;
                    }
                    bool checkResult = false;
                    if (item["IsPass"].ToString() == "1")
                    {
                        checkResult = true;
                    }
                    if (!string.IsNullOrEmpty(trainingId) && !string.IsNullOrEmpty(personId))
                    {
                        Model.EduTrain_TrainRecordDetail newTrainRecordDetail = new Model.EduTrain_TrainRecordDetail
                        {
                            TrainingId  = trainingId,
                            PersonId    = personId,
                            CheckScore  = Funs.GetNewDecimal(item["Score"].ToString()),
                            CheckResult = checkResult,
                        };

                        var getTrainRecordDetail = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.TrainingId == trainingId && x.PersonId == personId);
                        if (getTrainRecordDetail == null)
                        {
                            EduTrain_TrainRecordDetailService.AddTrainDetail(newTrainRecordDetail);
                        }
                        else
                        {
                            getTrainRecordDetail.CheckScore  = newTrainRecordDetail.CheckScore;
                            getTrainRecordDetail.CheckResult = newTrainRecordDetail.CheckResult;
                            EduTrain_TrainRecordDetailService.UpdateTrainDetail(getTrainRecordDetail);
                        }
                    }
                    else
                    {
                        isOk = false;
                    }
                }
            }
            catch (Exception ex)
            {
                isOk = false;
                ErrLogInfo.WriteLog(string.Empty, ex);
            }
            return(isOk);
        }
示例#7
0
        /// <summary>
        /// 插入人员培训记录 5
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="arr"></param>
        public static bool AddPersonTrainRecord(string projectId, JArray arr, Model.Sys_User user)
        {
            Model.SUBHSSEDB db   = Funs.DB;
            bool            isOk = true;

            try
            {
                foreach (var item in arr)
                {
                    string id = item["ID"].ToString();
                    if (!string.IsNullOrEmpty(id))
                    {
                        bool isPass = false;
                        if (item["IsPass"].ToString() == "1")
                        {
                            isPass = true;
                        }

                        Model.EduTrain_TrainPersonRecord newTrainPersonRecord = new Model.EduTrain_TrainPersonRecord
                        {
                            ID             = id,
                            ProjectId      = projectId,
                            EmpName        = item["EmpName"].ToString(),
                            IdentifyId     = item["IdentifyId"].ToString(),
                            CategoryName   = item["CategoryName"].ToString(),
                            RecordId       = item["RecordId"].ToString(),
                            DepartId       = item["DepartId"].ToString(),
                            DepartName     = item["DepartName"].ToString(),
                            TrainPeriod    = item["TrainPeriod"].ToString(),
                            TotalScore     = item["TotalScore"].ToString(),
                            PassScore      = item["PassScore"].ToString(),
                            Score          = item["Score"].ToString(),
                            IsPass         = isPass,
                            GroupNo        = item["GroupNo"].ToString(),
                            ExamNo         = item["ExamNo"].ToString(),
                            ExamCount      = item["ExamCount"].ToString(),
                            DeviceNo       = item["DeviceNo"].ToString(),
                            OwnerDepartId  = item["OwnerDepartId"].ToString(),
                            Answers        = item["Answers"].ToString(),
                            RecordName     = item["RecordName"].ToString(),
                            TrainType      = item["TrainType"].ToString(),
                            PaperMode      = item["PaperMode"].ToString(),
                            TrainMode      = item["TrainMode"].ToString(),
                            TrainPrincipal = item["TrainPrincipal"].ToString(),
                            TrainStartDate = Funs.GetNewDateTime(item["TrainStartDate"].ToString()),
                            TrainEndDate   = Funs.GetNewDateTime(item["TrainEndDate"].ToString()),
                            TrainContent   = item["TrainContent"].ToString(),
                            TrainDescript  = item["TrainDescript"].ToString(),
                        };

                        var getnewTrainPersonRecord = db.EduTrain_TrainPersonRecord.FirstOrDefault(x => x.ID == id);
                        if (getnewTrainPersonRecord == null)
                        {
                            db.EduTrain_TrainPersonRecord.InsertOnSubmit(newTrainPersonRecord);
                            db.SubmitChanges();
                        }
                        else
                        {
                            db.SubmitChanges();
                        }
                    }
                    else
                    {
                        isOk = false;
                    }
                }
            }
            catch (Exception ex)
            {
                isOk = false;
                ErrLogInfo.WriteLog(string.Empty, ex);
            }
            return(isOk);
        }
示例#8
0
        /// <summary>
        /// 根据安全工作总结Id获取安全工作总结信息
        /// </summary>
        /// <param name="ManagerTotalId"></param>
        /// <returns></returns>
        public static List <Model.SpManagerTotalMonthSafetyDataDItem> GetManager_SafetyDataD(string date)
        {
            List <Model.SpManagerTotalMonthSafetyDataDItem> reportSafetyDataD = new List <Model.SpManagerTotalMonthSafetyDataDItem>();
            DateTime?monthTime   = Funs.GetNewDateTime(date);
            var      projectList = BLL.ProjectService.GetTotalMonthProjectWorkList(monthTime);
            int      sortIndex   = 1;

            Model.SpManagerTotalMonthSafetyDataDItem sunmPart = new Model.SpManagerTotalMonthSafetyDataDItem
            {
                ID                   = SQLHelper.GetNewID(typeof(Model.Manager_ManagerTotalMonth)),
                ProjectName          = "合计",
                ThisUnitPersonNum    = "0",
                ThisUnitHSEPersonNum = "0",
                SubUnitPersonNum     = "0",
                SubUnitHSEPersonNum  = "0",
                ManHours             = "0",
                HSEManHours          = "0"
            };

            foreach (var projectItem in projectList)
            {
                Model.SpManagerTotalMonthSafetyDataDItem part = new Model.SpManagerTotalMonthSafetyDataDItem
                {
                    ID                   = projectItem.ProjectId,
                    ProjectName          = projectItem.ProjectName,
                    SortIndex            = sortIndex,
                    ThisUnitPersonNum    = "/",
                    ThisUnitHSEPersonNum = "/",
                    SubUnitPersonNum     = "/",
                    SubUnitHSEPersonNum  = "/",
                    ManHours             = "/",
                    HSEManHours          = "/"
                };
                var projectMontReportD = Funs.DB.Manager_MonthReportD.FirstOrDefault(x => x.ProjectId == projectItem.ProjectId && (x.Months.Value.Year == monthTime.Value.Year && x.Months.Value.Month == monthTime.Value.Month));
                if (projectMontReportD != null)
                {
                    var safetyDataD = Funs.DB.Manager_SafetyDataD.FirstOrDefault(x => x.MonthReportId == projectMontReportD.MonthReportId);
                    if (safetyDataD != null)
                    {
                        part.ThisUnitPersonNum    = safetyDataD.ThisUnitPersonNum.ToString();
                        part.ThisUnitHSEPersonNum = safetyDataD.ThisUnitHSEPersonNum.ToString();
                        part.SubUnitPersonNum     = safetyDataD.SubUnitPersonNum.ToString();
                        part.SubUnitHSEPersonNum  = safetyDataD.SubUnitHSEPersonNum.ToString();
                        part.ManHours             = safetyDataD.ManHours.ToString();
                        part.HSEManHours          = safetyDataD.HSEManHours.ToString();

                        sunmPart.ThisUnitPersonNum    = (Funs.GetNewIntOrZero(sunmPart.ThisUnitPersonNum) + Funs.GetNewIntOrZero(part.ThisUnitPersonNum)).ToString();
                        sunmPart.ThisUnitHSEPersonNum = (Funs.GetNewIntOrZero(sunmPart.ThisUnitHSEPersonNum) + Funs.GetNewIntOrZero(part.ThisUnitHSEPersonNum)).ToString();
                        sunmPart.SubUnitPersonNum     = (Funs.GetNewIntOrZero(sunmPart.SubUnitPersonNum) + Funs.GetNewIntOrZero(part.SubUnitPersonNum)).ToString();
                        sunmPart.SubUnitHSEPersonNum  = (Funs.GetNewIntOrZero(sunmPart.SubUnitHSEPersonNum) + Funs.GetNewIntOrZero(part.SubUnitHSEPersonNum)).ToString();
                        sunmPart.ManHours             = (Funs.GetNewIntOrZero(sunmPart.ManHours) + Funs.GetNewIntOrZero(part.ManHours)).ToString();
                        sunmPart.HSEManHours          = (Funs.GetNewIntOrZero(sunmPart.HSEManHours) + Funs.GetNewIntOrZero(part.HSEManHours)).ToString();
                    }
                }
                reportSafetyDataD.Add(part);
                sortIndex++;
            }
            sunmPart.SortIndex = projectList.Count() + 1;

            reportSafetyDataD.Add(sunmPart);
            return(reportSafetyDataD);
        }
示例#9
0
        /// <summary>
        /// 根据安全工作总结Id获取安全工作总结信息
        /// </summary>
        /// <param name="ManagerTotalId"></param>
        /// <returns></returns>
        public static List <Model.SpManagerTotalMonthItem> GetManager_ManagerTotalMonthItem(string date)
        {
            DateTime?monthTime        = Funs.GetNewDateTime(date);
            var      managerTotalList = BLL.ManagerTotalMonthService.GetManagerTotalByDate(monthTime.Value);
            var      projectList      = BLL.ProjectService.GetTotalMonthProjectWorkList(monthTime);
            List <Model.SpManagerTotalMonthItem> reportItemPartList = new List <Model.SpManagerTotalMonthItem>();
            int projectCount = projectList.Count();
            int rows         = 1;
            int sortIndex    = 1;

            foreach (var projectItem in projectList)
            {
                var managerTotalProject = managerTotalList.FirstOrDefault(x => x.ProjectId == projectItem.ProjectId);
                if (managerTotalProject != null)
                {
                    var managerTotalItems = from x in Funs.DB.Manager_ManagerTotalMonthItem where x.ManagerTotalMonthId == managerTotalProject.ManagerTotalMonthId select x;
                    if (managerTotalItems.Count() > 0)
                    {
                        foreach (var item in managerTotalItems)
                        {
                            Model.SpManagerTotalMonthItem part = new Model.SpManagerTotalMonthItem
                            {
                                ID                    = SQLHelper.GetNewID(typeof(Model.Manager_ManagerTotalMonthItem)),
                                ProjectName           = projectItem.ProjectName,
                                ExistenceHiddenDanger = item.ExistenceHiddenDanger,
                                CorrectiveActions     = item.CorrectiveActions,
                                PlanCompletedDate     = string.Format("{0:yyyy-MM-dd}", item.PlanCompletedDate),
                                ResponsiMan           = item.ResponsiMan,
                                ActualCompledDate     = string.Format("{0:yyyy-MM-dd}", item.ActualCompledDate),
                                Remark                = item.Remark,
                                SortIndex             = sortIndex
                            };
                            reportItemPartList.Add(part);
                            sortIndex++;
                        }
                    }
                    else
                    {
                        Model.SpManagerTotalMonthItem part = new Model.SpManagerTotalMonthItem
                        {
                            ID                    = SQLHelper.GetNewID(typeof(Model.Manager_ManagerTotalMonthItem)),
                            ProjectName           = projectItem.ProjectName,
                            ExistenceHiddenDanger = "/",
                            CorrectiveActions     = "/",
                            PlanCompletedDate     = null,
                            ResponsiMan           = "/",
                            ActualCompledDate     = null,
                            Remark                = "/",
                            SortIndex             = sortIndex
                        };
                        reportItemPartList.Add(part);
                        sortIndex++;
                    }
                }
                else
                {
                    Model.SpManagerTotalMonthItem part = new Model.SpManagerTotalMonthItem
                    {
                        ID                    = SQLHelper.GetNewID(typeof(Model.Manager_ManagerTotalMonthItem)),
                        ProjectName           = projectItem.ProjectName,
                        ExistenceHiddenDanger = "/",
                        CorrectiveActions     = "/",
                        PlanCompletedDate     = "/",
                        ResponsiMan           = "/",
                        ActualCompledDate     = "/",
                        Remark                = "/",
                        SortIndex             = sortIndex
                    };
                    reportItemPartList.Add(part);
                    sortIndex++;
                }

                if (projectCount > rows)
                {
                    Model.SpManagerTotalMonthItem partNull = new Model.SpManagerTotalMonthItem
                    {
                        ID                    = SQLHelper.GetNewID(typeof(Model.Manager_ManagerTotalMonthItem)),
                        ProjectName           = "项目名称",
                        ExistenceHiddenDanger = "存在隐患",
                        CorrectiveActions     = "整改措施",
                        PlanCompletedDate     = "计划完成时间",
                        ResponsiMan           = "责任人",
                        ActualCompledDate     = "实际完成时间",
                        Remark                = "备注",
                        SortIndex             = sortIndex
                    };
                    reportItemPartList.Add(partNull);
                    sortIndex++;
                }

                rows++;
            }

            return(reportItemPartList);
        }
示例#10
0
        /// <summary>
        /// 保存emergencyInfo
        /// </summary>
        /// <param name="emergencyInfo">会议信息</param>
        /// <returns></returns>
        public static void SaveEmergency(Model.FileInfoItem emergencyInfo)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                string menuId = string.Empty;
                if (emergencyInfo.MenuType == "1")
                {
                    Model.Emergency_EmergencyList newEmergency = new Model.Emergency_EmergencyList
                    {
                        EmergencyListId   = emergencyInfo.FileId,
                        ProjectId         = emergencyInfo.ProjectId,
                        UnitId            = emergencyInfo.UnitId == "" ? null : emergencyInfo.UnitId,
                        EmergencyTypeId   = emergencyInfo.FileType == "" ? null : emergencyInfo.FileType,
                        EmergencyCode     = emergencyInfo.FileCode,
                        EmergencyName     = emergencyInfo.FileName,
                        EmergencyContents = emergencyInfo.FileContent,
                        CompileMan        = emergencyInfo.CompileManId,
                        CompileDate       = Funs.GetNewDateTime(emergencyInfo.CompileDate),
                        States            = Const.State_2,
                    };
                    if (!string.IsNullOrEmpty(emergencyInfo.AuditManId))
                    {
                        newEmergency.AuditMan = emergencyInfo.AuditManId;
                    }
                    if (!string.IsNullOrEmpty(emergencyInfo.ApproveManId))
                    {
                        newEmergency.ApproveMan = emergencyInfo.ApproveManId;
                    }
                    if (emergencyInfo.States != Const.State_1)
                    {
                        newEmergency.States = Const.State_0;
                    }
                    var updateEmergency = db.Emergency_EmergencyList.FirstOrDefault(x => x.EmergencyListId == emergencyInfo.FileId);
                    if (updateEmergency == null)
                    {
                        newEmergency.CompileDate   = DateTime.Now;
                        emergencyInfo.FileId       = newEmergency.EmergencyListId = SQLHelper.GetNewID();
                        newEmergency.EmergencyCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectClassMeetingMenuId, newEmergency.ProjectId, null);
                        db.Emergency_EmergencyList.InsertOnSubmit(newEmergency);
                        db.SubmitChanges();
                        ////增加一条编码记录
                        CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectEmergencyListMenuId, newEmergency.ProjectId, null, newEmergency.EmergencyListId, newEmergency.CompileDate);
                    }
                    else
                    {
                        updateEmergency.EmergencyName     = newEmergency.EmergencyName;
                        updateEmergency.UnitId            = newEmergency.UnitId;
                        updateEmergency.EmergencyTypeId   = newEmergency.EmergencyTypeId;
                        updateEmergency.EmergencyContents = newEmergency.EmergencyContents;
                        updateEmergency.AuditMan          = newEmergency.AuditMan;
                        updateEmergency.ApproveMan        = newEmergency.ApproveMan;
                        db.SubmitChanges();
                    }
                    if (emergencyInfo.States == Const.State_1)
                    {
                        CommonService.btnSaveData(newEmergency.ProjectId, Const.ProjectEmergencyListMenuId, newEmergency.EmergencyListId, newEmergency.CompileMan, true, newEmergency.EmergencyName, "../Emergency/EmergencyListView.aspx?EmergencyListId={0}");
                    }

                    menuId = Const.ProjectEmergencyListMenuId;
                }
                else if (emergencyInfo.MenuType == "2")
                {
                    Model.Emergency_EmergencySupply newEmergency = new Model.Emergency_EmergencySupply
                    {
                        FileId      = emergencyInfo.FileId,
                        ProjectId   = emergencyInfo.ProjectId,
                        UnitId      = emergencyInfo.UnitId == "" ? null : emergencyInfo.UnitId,
                        FileCode    = emergencyInfo.FileCode,
                        FileName    = emergencyInfo.FileName,
                        FileContent = emergencyInfo.FileContent,
                        CompileMan  = emergencyInfo.CompileManId,
                        CompileDate = Funs.GetNewDateTime(emergencyInfo.CompileDate),
                        States      = Const.State_2,
                    };

                    if (emergencyInfo.States != Const.State_1)
                    {
                        newEmergency.States = Const.State_0;
                    }
                    var updateEmergency = db.Emergency_EmergencySupply.FirstOrDefault(x => x.FileId == emergencyInfo.FileId);
                    if (updateEmergency == null)
                    {
                        newEmergency.CompileDate = DateTime.Now;
                        emergencyInfo.FileId     = newEmergency.FileId = SQLHelper.GetNewID();
                        newEmergency.FileCode    = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectEmergencySupplyMenuId, newEmergency.ProjectId, null);
                        db.Emergency_EmergencySupply.InsertOnSubmit(newEmergency);
                    }
                    else
                    {
                        updateEmergency.UnitId      = newEmergency.UnitId;
                        updateEmergency.FileCode    = newEmergency.FileCode;
                        updateEmergency.FileName    = newEmergency.FileName;
                        updateEmergency.FileContent = newEmergency.FileContent;
                        db.SubmitChanges();
                    }
                    if (emergencyInfo.States == Const.State_1)
                    {
                        CommonService.btnSaveData(newEmergency.ProjectId, Const.ProjectEmergencySupplyMenuId, newEmergency.FileId, newEmergency.CompileMan, true, newEmergency.FileName, "../Emergency/EmergencySupplyView.aspx?FileId={0}");
                    }
                    menuId = Const.ProjectEmergencySupplyMenuId;
                }
                else if (emergencyInfo.MenuType == "3")
                {
                    Model.Emergency_EmergencyTeamAndTrain newEmergency = new Model.Emergency_EmergencyTeamAndTrain
                    {
                        FileId      = emergencyInfo.FileId,
                        ProjectId   = emergencyInfo.ProjectId,
                        UnitId      = emergencyInfo.UnitId == "" ? null : emergencyInfo.UnitId,
                        FileCode    = emergencyInfo.FileCode,
                        FileName    = emergencyInfo.FileName,
                        FileContent = emergencyInfo.FileContent,
                        CompileMan  = emergencyInfo.CompileManId,
                        CompileDate = Funs.GetNewDateTime(emergencyInfo.CompileDate),
                        States      = Const.State_2,
                    };

                    if (emergencyInfo.States != Const.State_1)
                    {
                        newEmergency.States = Const.State_0;
                    }

                    var updateEmergency = db.Emergency_EmergencyTeamAndTrain.FirstOrDefault(x => x.FileId == emergencyInfo.FileId);
                    if (updateEmergency == null)
                    {
                        newEmergency.CompileDate = DateTime.Now;
                        emergencyInfo.FileId     = newEmergency.FileId = SQLHelper.GetNewID();
                        newEmergency.FileCode    = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectEmergencyTeamAndTrainMenuId, newEmergency.ProjectId, null);
                        db.Emergency_EmergencyTeamAndTrain.InsertOnSubmit(newEmergency);
                    }
                    else
                    {
                        updateEmergency.UnitId      = newEmergency.UnitId;
                        updateEmergency.FileCode    = newEmergency.FileCode;
                        updateEmergency.FileName    = newEmergency.FileName;
                        updateEmergency.FileContent = newEmergency.FileContent;
                        db.SubmitChanges();
                        var delItem = from x in db.Emergency_EmergencyTeamItem where x.FileId == updateEmergency.FileId select x;
                        if (delItem.Count() > 0)
                        {
                            db.Emergency_EmergencyTeamItem.DeleteAllOnSubmit(delItem);
                            db.SubmitChanges();
                        }
                    }
                    if (emergencyInfo.EmergencyTeamItem != null && emergencyInfo.EmergencyTeamItem.Count() > 0)
                    {
                        var getItems = from x in emergencyInfo.EmergencyTeamItem
                                       select new Model.Emergency_EmergencyTeamItem
                        {
                            EmergencyTeamItemId = x.EmergencyTeamItemId,
                            FileId   = x.FileId,
                            PersonId = x.PersonId,
                            Job      = x.Job,
                            Tel      = x.Tel,
                        };
                        if (getItems.Count() > 0)
                        {
                            Funs.DB.Emergency_EmergencyTeamItem.InsertAllOnSubmit(getItems);
                            Funs.DB.SubmitChanges();
                        }
                    }

                    if (emergencyInfo.States == Const.State_1)
                    {
                        CommonService.btnSaveData(newEmergency.ProjectId, Const.ProjectEmergencyTeamAndTrainMenuId, newEmergency.FileId, newEmergency.CompileMan, true, newEmergency.FileName, "../Emergency/EmergencyTeamAndTrainView.aspx?FileId={0}");
                    }
                    menuId = Const.ProjectEmergencyTeamAndTrainMenuId;
                }
                else
                {
                }
                ///// 附件保存
                if (!string.IsNullOrEmpty(menuId) && !string.IsNullOrEmpty(emergencyInfo.FileId))
                {
                    APIUpLoadFileService.SaveAttachUrl(menuId, emergencyInfo.FileId, emergencyInfo.AttachUrl, "0");
                }
            }
        }
示例#11
0
        /// <summary>
        /// 保存TrainingPlan
        /// </summary>
        /// <param name="trainingPlan">培训计划记录</param>
        /// <param name="trainingTasks">培训人员list</param>
        /// <param name="trainingPlanItems">培训教材类型list</param>
        public static void SaveTrainingPlan(Model.TrainingPlanItem trainingPlan)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                Model.Training_Plan newTrainingPlan = new Model.Training_Plan
                {
                    PlanId         = trainingPlan.PlanId,
                    PlanCode       = trainingPlan.PlanCode,
                    ProjectId      = trainingPlan.ProjectId,
                    DesignerId     = trainingPlan.DesignerId,
                    PlanName       = trainingPlan.PlanName,
                    TrainContent   = trainingPlan.TrainContent,
                    TrainStartDate = Funs.GetNewDateTime(trainingPlan.TrainStartDate),
                    TeachHour      = trainingPlan.TeachHour,
                    TeachMan       = trainingPlan.TeachMan,
                    TeachAddress   = trainingPlan.TeachAddress,
                    TrainTypeId    = trainingPlan.TrainTypeId,
                    UnitIds        = trainingPlan.UnitIds,
                    WorkPostId     = trainingPlan.WorkPostId,
                    States         = trainingPlan.States,
                };

                if (!string.IsNullOrEmpty(trainingPlan.TrainLevelId))
                {
                    newTrainingPlan.TrainLevelId = trainingPlan.TrainLevelId;
                }

                if (newTrainingPlan.TrainStartDate.HasValue && newTrainingPlan.TeachHour.HasValue)
                {
                    double dd = (double)((decimal)newTrainingPlan.TeachHour.Value);
                    newTrainingPlan.TrainEndDate = newTrainingPlan.TrainStartDate.Value.AddHours(dd);
                }

                List <Model.TrainingTaskItem>     trainingTasks     = trainingPlan.TrainingTasks;
                List <Model.TrainingPlanItemItem> trainingPlanItems = trainingPlan.TrainingPlanItems;

                var isUpdate = db.Training_Plan.FirstOrDefault(x => x.PlanId == newTrainingPlan.PlanId);
                if (isUpdate == null)
                {
                    newTrainingPlan.DesignerDate = DateTime.Now;
                    string unitId = string.Empty;
                    var    user   = UserService.GetUserByUserId(newTrainingPlan.DesignerId);
                    if (user != null)
                    {
                        unitId = user.UnitId;
                    }
                    newTrainingPlan.PlanCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainingPlanMenuId, newTrainingPlan.ProjectId, unitId);
                    if (string.IsNullOrEmpty(newTrainingPlan.PlanId))
                    {
                        newTrainingPlan.PlanId = SQLHelper.GetNewID();
                    }
                    db.Training_Plan.InsertOnSubmit(newTrainingPlan);
                    db.SubmitChanges();

                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainingPlanMenuId, newTrainingPlan.ProjectId, null, newTrainingPlan.PlanId, newTrainingPlan.DesignerDate);
                }
                else
                {
                    if (newTrainingPlan.States == "0" || newTrainingPlan.States == "1")
                    {
                        isUpdate.PlanName       = newTrainingPlan.PlanName;
                        isUpdate.TrainContent   = newTrainingPlan.TrainContent;
                        isUpdate.TrainStartDate = newTrainingPlan.TrainStartDate;
                        isUpdate.TeachHour      = newTrainingPlan.TeachHour;
                        isUpdate.TrainEndDate   = newTrainingPlan.TrainEndDate;
                        isUpdate.TeachMan       = newTrainingPlan.TeachMan;
                        isUpdate.TeachAddress   = newTrainingPlan.TeachAddress;
                        isUpdate.TrainTypeId    = newTrainingPlan.TrainTypeId;
                        isUpdate.TrainLevelId   = newTrainingPlan.TrainLevelId;
                        isUpdate.UnitIds        = newTrainingPlan.UnitIds;
                        isUpdate.WorkPostId     = newTrainingPlan.WorkPostId;
                        isUpdate.States         = newTrainingPlan.States;
                        db.SubmitChanges();
                    }
                    ////删除培训任务
                    var tasks = from x in db.Training_Task where x.PlanId == newTrainingPlan.PlanId select x;
                    if (tasks.Count() > 0)
                    {
                        var taskItems = from x in db.Training_TaskItem where x.PlanId == newTrainingPlan.PlanId select x;
                        if (tasks.Count() > 0)
                        {
                            db.Training_TaskItem.DeleteAllOnSubmit(taskItems);
                            db.SubmitChanges();
                        }
                        db.Training_Task.DeleteAllOnSubmit(tasks);
                        db.SubmitChanges();
                    }

                    ////删除培训教材类型
                    var planItem = (from x in db.Training_PlanItem where x.PlanId == newTrainingPlan.PlanId select x).ToList();
                    if (planItem.Count() > 0)
                    {
                        db.Training_PlanItem.DeleteAllOnSubmit(planItem);
                        db.SubmitChanges();
                    }
                }

                if (trainingTasks.Count() > 0)
                {
                    ////新增培训人员明细
                    foreach (var item in trainingTasks)
                    {
                        if (!string.IsNullOrEmpty(item.PersonId))
                        {
                            Model.Training_Task newTrainDetail = new Model.Training_Task
                            {
                                TaskId    = SQLHelper.GetNewID(),
                                ProjectId = newTrainingPlan.ProjectId,
                                PlanId    = newTrainingPlan.PlanId,
                                UserId    = item.PersonId,
                                TaskDate  = DateTime.Now,
                                States    = Const.State_0, ////未生成培训教材明细
                            };
                            db.Training_Task.InsertOnSubmit(newTrainDetail);
                            db.SubmitChanges();
                        }
                    }
                }
                if (trainingPlanItems.Count() > 0)
                {
                    ////新增培训教材类型明细
                    foreach (var item in trainingPlanItems)
                    {
                        if (!string.IsNullOrEmpty(item.CompanyTrainingId) || !string.IsNullOrEmpty(item.CompanyTrainingItemId))
                        {
                            Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem
                            {
                                PlanItemId = SQLHelper.GetNewID(),
                                PlanId     = newTrainingPlan.PlanId,
                            };
                            if (!string.IsNullOrEmpty(item.CompanyTrainingId))
                            {
                                newPlanItem.CompanyTrainingId = item.CompanyTrainingId;
                            }
                            if (!string.IsNullOrEmpty(item.CompanyTrainingItemId))
                            {
                                newPlanItem.CompanyTrainingItemId = item.CompanyTrainingItemId;
                            }
                            db.Training_PlanItem.InsertOnSubmit(newPlanItem);
                            db.SubmitChanges();
                        }
                    }
                }
            }
        }
示例#12
0
        /// <summary>
        /// 保存HazardRegister
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public static void SaveHazardRegister(Model.HazardRegisterItem hazardRegister)
        {
            Model.HSSE_Hazard_HazardRegister newHazardRegister = new Model.HSSE_Hazard_HazardRegister
            {
                HazardRegisterId      = hazardRegister.HazardRegisterId,
                HazardCode            = hazardRegister.HazardCode,
                RegisterDef           = hazardRegister.RegisterDef,
                Rectification         = hazardRegister.Rectification,
                Place                 = hazardRegister.Place,
                ResponsibleUnit       = hazardRegister.ResponsibleUnit,
                ProjectId             = hazardRegister.ProjectId,
                States                = hazardRegister.States,
                IsEffective           = "1",
                ResponsibleMan        = hazardRegister.ResponsibleMan,
                CheckManId            = hazardRegister.CheckManId,
                CheckTime             = hazardRegister.CheckTime,
                RectificationPeriod   = hazardRegister.RectificationPeriod,
                ImageUrl              = hazardRegister.ImageUrl,
                RectificationImageUrl = hazardRegister.RectificationImageUrl,
                RectificationTime     = hazardRegister.RectificationTime,
                ConfirmMan            = hazardRegister.ConfirmMan,
                ConfirmDate           = hazardRegister.ConfirmDate,
                HandleIdea            = hazardRegister.HandleIdea,
                CutPayment            = hazardRegister.CutPayment,
                ProblemTypes          = hazardRegister.ProblemTypes,
                RegisterTypesId       = hazardRegister.RegisterTypesId,
                CheckCycle            = hazardRegister.CheckCycle,
                SafeSupervisionIsOK   = hazardRegister.SafeSupervisionIsOK,
                IsWx         = "Y",
                CCManIds     = hazardRegister.CCManIds,
                Requirements = hazardRegister.Requirements,
            };
            var isUpdate = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == newHazardRegister.HazardRegisterId);

            if (isUpdate == null)
            {
                newHazardRegister.RegisterDate = DateTime.Now;
                newHazardRegister.CheckTime    = DateTime.Now;
                if (string.IsNullOrEmpty(newHazardRegister.HazardRegisterId))
                {
                    newHazardRegister.HazardRegisterId = SQLHelper.GetNewID();
                }
                Funs.DB.HSSE_Hazard_HazardRegister.InsertOnSubmit(newHazardRegister);
            }
            else
            {
                if (newHazardRegister.States == "2")
                {
                    isUpdate.RectificationTime     = DateTime.Now;
                    isUpdate.Rectification         = newHazardRegister.Rectification;
                    isUpdate.RectificationImageUrl = newHazardRegister.RectificationImageUrl;
                }
                else
                {
                    isUpdate.ConfirmDate         = DateTime.Now;
                    isUpdate.ConfirmMan          = newHazardRegister.ConfirmMan;
                    isUpdate.HandleIdea          = newHazardRegister.HandleIdea;
                    isUpdate.SafeSupervisionIsOK = newHazardRegister.SafeSupervisionIsOK;
                }

                isUpdate.States = newHazardRegister.States;
            }
            Funs.SubmitChanges();

            if (hazardRegister.States == Const.State_1)
            {
                APICommonService.SendSubscribeMessage(hazardRegister.ResponsibleMan, "安全巡检问题待整改", hazardRegister.CheckManName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", hazardRegister.CheckTime));
            }
            else if (hazardRegister.States == Const.State_2)
            {
                APICommonService.SendSubscribeMessage(hazardRegister.CheckManId, "安全巡检待复查验收", hazardRegister.ResponsibilityManName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", hazardRegister.RectificationTime));
            }
        }
示例#13
0
        /// <summary>
        /// 获取用户登录信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public static Model.UserItem UserLogOn(Model.UserItem userInfo)
        {
            var getUser = Funs.DB.View_Sys_User.FirstOrDefault(x => (x.Account == userInfo.Account || x.Telephone == userInfo.Telephone) && x.IsPost == true && x.Password == Funs.EncryptionPassword(userInfo.Password));

            return(ObjectMapperManager.DefaultInstance.GetMapper <Model.View_Sys_User, Model.UserItem>().Map(getUser));
        }
示例#14
0
        /// <summary>
        /// 保存Meeting
        /// </summary>
        /// <param name="meeting">会议信息</param>
        /// <returns></returns>
        public static void SaveMeeting(Model.MeetingItem meeting)
        {
            Model.SUBHSSEDB db     = Funs.DB;
            string          menuId = string.Empty;

            if (meeting.MeetingType == "C")
            {
                Model.Meeting_ClassMeeting newClassMeeting = new Model.Meeting_ClassMeeting
                {
                    ClassMeetingId       = meeting.MeetingId,
                    ProjectId            = meeting.ProjectId,
                    UnitId               = meeting.UnitId == "" ? null : meeting.UnitId,
                    TeamGroupId          = meeting.TeamGroupId == "" ? null : meeting.TeamGroupId,
                    ClassMeetingCode     = meeting.MeetingCode,
                    ClassMeetingName     = meeting.MeetingName,
                    ClassMeetingDate     = Funs.GetNewDateTime(meeting.MeetingDate),
                    ClassMeetingContents = meeting.MeetingContents,
                    CompileMan           = meeting.CompileManId,
                    MeetingPlace         = meeting.MeetingPlace,
                    MeetingHours         = meeting.MeetingHours,
                    MeetingHostMan       = meeting.MeetingHostMan,
                    AttentPerson         = meeting.AttentPerson,
                    AttentPersonNum      = meeting.AttentPersonNum,
                    States               = Const.State_2,
                };

                if (meeting.States != "1")
                {
                    newClassMeeting.States = Const.State_0;
                }

                var updateMeet = Funs.DB.Meeting_ClassMeeting.FirstOrDefault(x => x.ClassMeetingId == meeting.MeetingId);
                if (updateMeet == null)
                {
                    newClassMeeting.CompileDate      = DateTime.Now;
                    meeting.MeetingId                = newClassMeeting.ClassMeetingId = SQLHelper.GetNewID();
                    newClassMeeting.ClassMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectClassMeetingMenuId, newClassMeeting.ProjectId, null);
                    ClassMeetingService.AddClassMeeting(newClassMeeting);
                }
                else
                {
                    ClassMeetingService.UpdateClassMeeting(newClassMeeting);
                }
                if (meeting.States == "1")
                {
                    CommonService.btnSaveData(meeting.ProjectId, Const.ProjectClassMeetingMenuId, newClassMeeting.ClassMeetingId, newClassMeeting.CompileMan, true, newClassMeeting.ClassMeetingName, "../Meeting/ClassMeetingView.aspx?ClassMeetingId={0}");
                }

                menuId = Const.ProjectClassMeetingMenuId;
            }
            else if (meeting.MeetingType == "W")
            {
                Model.Meeting_WeekMeeting newWeekMeeting = new Model.Meeting_WeekMeeting
                {
                    WeekMeetingId       = meeting.MeetingId,
                    ProjectId           = meeting.ProjectId,
                    UnitId              = meeting.UnitId == "" ? null : meeting.UnitId,
                    WeekMeetingCode     = meeting.MeetingCode,
                    WeekMeetingName     = meeting.MeetingName,
                    WeekMeetingDate     = Funs.GetNewDateTime(meeting.MeetingDate),
                    WeekMeetingContents = meeting.MeetingContents,
                    CompileMan          = meeting.CompileManId,
                    CompileDate         = Funs.GetNewDateTime(meeting.CompileDate),
                    MeetingPlace        = meeting.MeetingPlace,
                    MeetingHours        = meeting.MeetingHours,
                    MeetingHostMan      = meeting.MeetingHostMan,
                    AttentPerson        = meeting.AttentPerson,
                    AttentPersonNum     = meeting.AttentPersonNum,
                    States              = Const.State_2,

                    AttentPersonIds = meeting.AttentPersonIds,
                };

                if (meeting.States != "1")
                {
                    newWeekMeeting.States = Const.State_0;
                }
                if (!string.IsNullOrEmpty(meeting.MeetingHostManId))
                {
                    newWeekMeeting.MeetingHostManId = meeting.MeetingHostManId;
                }

                var updateMeet = Funs.DB.Meeting_WeekMeeting.FirstOrDefault(x => x.WeekMeetingId == meeting.MeetingId);
                if (updateMeet == null)
                {
                    newWeekMeeting.CompileDate     = DateTime.Now;
                    meeting.MeetingId              = newWeekMeeting.WeekMeetingId = SQLHelper.GetNewID();
                    newWeekMeeting.WeekMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectWeekMeetingMenuId, newWeekMeeting.ProjectId, null);
                    WeekMeetingService.AddWeekMeeting(newWeekMeeting);
                }
                else
                {
                    WeekMeetingService.UpdateWeekMeeting(newWeekMeeting);
                }
                if (meeting.States == "1")
                {
                    CommonService.btnSaveData(meeting.ProjectId, Const.ProjectWeekMeetingMenuId, newWeekMeeting.WeekMeetingId, newWeekMeeting.CompileMan, true, newWeekMeeting.WeekMeetingName, "../Meeting/WeekMeetingView.aspx?WeekMeetingId={0}");
                }
                menuId = Const.ProjectWeekMeetingMenuId;
            }
            else if (meeting.MeetingType == "M")
            {
                Model.Meeting_MonthMeeting newMonthMeeting = new Model.Meeting_MonthMeeting
                {
                    MonthMeetingId       = meeting.MeetingId,
                    ProjectId            = meeting.ProjectId,
                    UnitId               = meeting.UnitId == "" ? null : meeting.UnitId,
                    MonthMeetingCode     = meeting.MeetingCode,
                    MonthMeetingName     = meeting.MeetingName,
                    MonthMeetingDate     = Funs.GetNewDateTime(meeting.MeetingDate),
                    MonthMeetingContents = meeting.MeetingContents,
                    CompileMan           = meeting.CompileManId,
                    CompileDate          = Funs.GetNewDateTime(meeting.CompileDate),
                    MeetingPlace         = meeting.MeetingPlace,
                    MeetingHours         = meeting.MeetingHours,
                    MeetingHostMan       = meeting.MeetingHostMan,
                    AttentPerson         = meeting.AttentPerson,
                    AttentPersonNum      = meeting.AttentPersonNum,
                    States               = Const.State_2,
                    AttentPersonIds      = meeting.AttentPersonIds,
                };

                if (meeting.States != "1")
                {
                    newMonthMeeting.States = Const.State_0;
                }
                if (!string.IsNullOrEmpty(meeting.MeetingHostManId))
                {
                    newMonthMeeting.MeetingHostManId = meeting.MeetingHostManId;
                }

                var updateMeet = Funs.DB.Meeting_MonthMeeting.FirstOrDefault(x => x.MonthMeetingId == meeting.MeetingId);
                if (updateMeet == null)
                {
                    newMonthMeeting.CompileDate      = DateTime.Now;
                    meeting.MeetingId                = newMonthMeeting.MonthMeetingId = SQLHelper.GetNewID();
                    newMonthMeeting.MonthMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectMonthMeetingMenuId, newMonthMeeting.ProjectId, null);
                    MonthMeetingService.AddMonthMeeting(newMonthMeeting);
                }
                else
                {
                    MonthMeetingService.UpdateMonthMeeting(newMonthMeeting);
                }
                if (meeting.States == "1")
                {
                    CommonService.btnSaveData(meeting.ProjectId, Const.ProjectMonthMeetingMenuId, newMonthMeeting.MonthMeetingId, newMonthMeeting.CompileMan, true, newMonthMeeting.MonthMeetingName, "../Meeting/MonthMeetingView.aspx?MonthMeetingId={0}");
                }
                menuId = Const.ProjectMonthMeetingMenuId;
            }
            else if (meeting.MeetingType == "S")
            {
                Model.Meeting_SpecialMeeting newSpecialMeeting = new Model.Meeting_SpecialMeeting
                {
                    SpecialMeetingId       = meeting.MeetingId,
                    ProjectId              = meeting.ProjectId,
                    UnitId                 = meeting.UnitId == "" ? null : meeting.UnitId,
                    SpecialMeetingCode     = meeting.MeetingCode,
                    SpecialMeetingName     = meeting.MeetingName,
                    SpecialMeetingDate     = Funs.GetNewDateTime(meeting.MeetingDate),
                    SpecialMeetingContents = meeting.MeetingContents,
                    CompileMan             = meeting.CompileManId,
                    CompileDate            = Funs.GetNewDateTime(meeting.CompileDate),
                    MeetingPlace           = meeting.MeetingPlace,
                    MeetingHours           = meeting.MeetingHours,
                    MeetingHostMan         = meeting.MeetingHostMan,
                    AttentPerson           = meeting.AttentPerson,
                    AttentPersonNum        = meeting.AttentPersonNum,
                    States                 = Const.State_2,
                    //MeetingHostManId = meeting.MeetingHostManId,
                    AttentPersonIds = meeting.AttentPersonIds,
                };

                if (meeting.States != "1")
                {
                    newSpecialMeeting.States = Const.State_0;
                }
                if (!string.IsNullOrEmpty(meeting.MeetingHostManId))
                {
                    newSpecialMeeting.MeetingHostManId = meeting.MeetingHostManId;
                }

                var updateMeet = Funs.DB.Meeting_SpecialMeeting.FirstOrDefault(x => x.SpecialMeetingId == meeting.MeetingId);
                if (updateMeet == null)
                {
                    newSpecialMeeting.CompileDate        = DateTime.Now;
                    meeting.MeetingId                    = newSpecialMeeting.SpecialMeetingId = SQLHelper.GetNewID();
                    newSpecialMeeting.SpecialMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectSpecialMeetingMenuId, newSpecialMeeting.ProjectId, null);
                    SpecialMeetingService.AddSpecialMeeting(newSpecialMeeting);
                }
                else
                {
                    SpecialMeetingService.UpdateSpecialMeeting(newSpecialMeeting);
                }
                if (meeting.States == "1")
                {
                    CommonService.btnSaveData(meeting.ProjectId, Const.ProjectSpecialMeetingMenuId, newSpecialMeeting.SpecialMeetingId, newSpecialMeeting.CompileMan, true, newSpecialMeeting.SpecialMeetingName, "../Meeting/SpecialMeetingView.aspx?SpecialMeetingId={0}");
                }
                menuId = Const.ProjectSpecialMeetingMenuId;
            }
            else
            {
                Model.Meeting_AttendMeeting newAttendMeeting = new Model.Meeting_AttendMeeting
                {
                    AttendMeetingId       = meeting.MeetingId,
                    ProjectId             = meeting.ProjectId,
                    UnitId                = meeting.UnitId == "" ? null : meeting.UnitId,
                    AttendMeetingCode     = meeting.MeetingCode,
                    AttendMeetingName     = meeting.MeetingName,
                    AttendMeetingDate     = Funs.GetNewDateTime(meeting.MeetingDate),
                    AttendMeetingContents = meeting.MeetingContents,
                    CompileMan            = meeting.CompileManId,
                    CompileDate           = Funs.GetNewDateTime(meeting.CompileDate),
                    MeetingPlace          = meeting.MeetingPlace,
                    MeetingHours          = meeting.MeetingHours,
                    MeetingHostMan        = meeting.MeetingHostMan,
                    AttentPerson          = meeting.AttentPerson,
                    AttentPersonNum       = meeting.AttentPersonNum,
                    States                = Const.State_2,
                    //MeetingHostManId = meeting.MeetingHostManId,
                    AttentPersonIds = meeting.AttentPersonIds,
                };

                if (meeting.States != "1")
                {
                    newAttendMeeting.States = Const.State_0;
                }
                if (!string.IsNullOrEmpty(meeting.MeetingHostManId))
                {
                    newAttendMeeting.MeetingHostManId = meeting.MeetingHostManId;
                }

                var updateMeet = Funs.DB.Meeting_AttendMeeting.FirstOrDefault(x => x.AttendMeetingId == meeting.MeetingId);
                if (updateMeet == null)
                {
                    newAttendMeeting.CompileDate       = DateTime.Now;
                    meeting.MeetingId                  = newAttendMeeting.AttendMeetingId = SQLHelper.GetNewID();
                    newAttendMeeting.AttendMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectAttendMeetingMenuId, newAttendMeeting.ProjectId, null);
                    AttendMeetingService.AddAttendMeeting(newAttendMeeting);
                }
                else
                {
                    AttendMeetingService.UpdateAttendMeeting(newAttendMeeting);
                }
                if (meeting.States == "1")
                {
                    CommonService.btnSaveData(meeting.ProjectId, Const.ProjectAttendMeetingMenuId, newAttendMeeting.AttendMeetingId, newAttendMeeting.CompileMan, true, newAttendMeeting.AttendMeetingName, "../Meeting/AttendMeetingView.aspx?AttendMeetingId={0}");
                }
                menuId = Const.ProjectAttendMeetingMenuId;
            }
            if (!string.IsNullOrEmpty(menuId) && !string.IsNullOrEmpty(meeting.MeetingId))
            {
                SaveMeetUrl(meeting.MeetingId, menuId, meeting.AttachUrl, meeting.AttachUrl1, meeting.AttachUrl2);
            }
        }
示例#15
0
        /// <summary>
        /// 插入人员信息 0
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="arr"></param>
        public static bool AddPerson(string projectId, JArray arr, Model.Sys_User user)
        {
            Model.SUBHSSEDB db   = Funs.DB;
            bool            isOk = true;

            try
            {
                foreach (var item in arr)
                {
                    ////单位
                    string unitId  = null;
                    var    getUnit = db.Base_Unit.FirstOrDefault(x => x.FromUnitId == item["DepartId"].ToString());
                    if (getUnit != null)
                    {
                        unitId = getUnit.UnitId;
                    }

                    ///区域
                    string workAreaId  = null;
                    var    getWorkArea = db.ProjectData_WorkArea.FirstOrDefault(x => x.ProjectId == projectId && x.WorkAreaName == item["BuildArea"].ToString());
                    if (getWorkArea != null)
                    {
                        workAreaId = getWorkArea.WorkAreaId;
                    }
                    ///岗位
                    string workPostId  = null;
                    var    getWorkPost = db.Base_WorkPost.FirstOrDefault(x => x.WorkPostName == item["Station"].ToString());
                    if (getWorkPost != null)
                    {
                        workPostId = getWorkPost.WorkPostId;
                    }
                    DateTime?inTime  = Funs.GetNewDateTime(item["EntranceDate"].ToString());
                    DateTime?outTime = Funs.GetNewDateTime(item["LeaveDate"].ToString());
                    if (outTime < inTime)
                    {
                        outTime = null;
                    }
                    string IdentifyID = item["IdentifyID"].ToString();
                    if (!string.IsNullOrEmpty(IdentifyID))
                    {
                        Model.SitePerson_Person newPerson = new Model.SitePerson_Person
                        {
                            FromPersonId = item["ID"].ToString(),
                            CardNo       = item["JobNumber"].ToString(),
                            PersonName   = item["Name"].ToString(),
                            Sex          = item["Sex"].ToString(),
                            IdentityCard = IdentifyID,
                            Address      = item["Address"].ToString(),
                            ProjectId    = projectId,
                            UnitId       = unitId,   /////映射取值
                            //TeamGroupId = person.TeamGroupId,
                            WorkAreaId = workAreaId, /////关联映射取值
                            WorkPostId = workPostId, /////关联映射取值
                            InTime     = inTime,
                            OutTime    = outTime,
                            Telephone  = item["ContactTel"].ToString(),
                            IsUsed     = true,
                            IsCardUsed = true,
                        };

                        var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.IdentityCard == IdentifyID);
                        if (getPerson == null)
                        {
                            newPerson.PersonId = SQLHelper.GetNewID(typeof(Model.SitePerson_Person));
                            PersonService.AddPerson(newPerson);
                            BLL.LogService.AddSys_Log(user, newPerson.PersonName, newPerson.PersonId, BLL.Const.PersonListMenuId, BLL.Const.BtnAdd);
                        }
                        else
                        {
                            getPerson.FromPersonId = newPerson.FromPersonId;
                            getPerson.InTime       = newPerson.InTime;
                            getPerson.OutTime      = newPerson.OutTime;
                            getPerson.Telephone    = newPerson.Telephone;
                            if (!string.IsNullOrEmpty(unitId))
                            {
                                getPerson.UnitId = unitId;
                            }
                            if (!string.IsNullOrEmpty(workAreaId))
                            {
                                getPerson.WorkAreaId = workAreaId;
                            }
                            if (!string.IsNullOrEmpty(workPostId))
                            {
                                getPerson.WorkPostId = workPostId;
                            }
                            PersonService.UpdatePerson(getPerson);
                            BLL.LogService.AddSys_Log(user, getPerson.PersonName, getPerson.PersonId, BLL.Const.PersonListMenuId, BLL.Const.BtnModify);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                isOk = false;
                ErrLogInfo.WriteLog(string.Empty, ex);
            }

            return(isOk);
        }
示例#16
0
        /// <summary>
        /// 根据时间段和类型获取事故损失金额
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="accidentType"></param>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public static decimal GetSumLosMoneyByAccidentTimeAndAccidentType(DateTime startTime, DateTime endTime, string accidentType, string projectId)
        {
            decimal loseMoney = 0;
            var     q         = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicLoss;

            foreach (var item in q)
            {
                if (item != null)
                {
                    loseMoney += Funs.GetNewDecimalOrZero(item.ToString());
                }
            }
            var c = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicOtherLoss;

            foreach (var item in c)
            {
                if (item != null)
                {
                    loseMoney += Funs.GetNewDecimalOrZero(item.ToString());
                }
            }
            //if (accidentType == "1" || accidentType == "2" || accidentType == "3")  //轻重死事故按审批完成时间
            //{
            //    var a = from x in Funs.DB.Accident_AccidentReport
            //            join y in Funs.DB.Sys_FlowOperate
            //            on x.AccidentReportId equals y.DataId
            //            where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
            //            && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
            //            select x.EconomicLoss;
            //    foreach (var item in a)
            //    {
            //        if (item != null)
            //        {
            //            loseMoney += Funs.GetNewDecimal(item.ToString());
            //        }
            //    }
            //    var b = from x in Funs.DB.Accident_AccidentReport
            //            join y in Funs.DB.Sys_FlowOperate
            //            on x.AccidentReportId equals y.DataId
            //            where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
            //            && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
            //            select x.EconomicOtherLoss;
            //    foreach (var item in b)
            //    {
            //        if (item != null)
            //        {
            //            loseMoney += Funs.GetNewDecimal(item.ToString());
            //        }
            //    }
            //}
            //else
            //{
            //    var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicLoss;
            //    foreach (var item in q)
            //    {
            //        if (item != null)
            //        {
            //            loseMoney += Funs.GetNewDecimal(item.ToString());
            //        }
            //    }
            //    var c = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicOtherLoss;
            //    foreach (var item in c)
            //    {
            //        if (item != null)
            //        {
            //            loseMoney += Funs.GetNewDecimal(item.ToString());
            //        }
            //    }
            //}
            return(loseMoney);
        }
示例#17
0
        /// <summary>
        /// 插入培训记录 2
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="arr"></param>
        public static bool AddTrainRecord(string projectId, JArray arr, Model.Sys_User user)
        {
            Model.SUBHSSEDB db   = Funs.DB;
            bool            isOk = true;

            try
            {
                foreach (var item in arr)
                {
                    string fromRecordId = item["ID"].ToString();
                    string trainTypeId  = null; ////培训类型
                    var    getTrainType = db.Base_TrainType.FirstOrDefault(x => x.TrainTypeName == item["TrainType"].ToString());
                    if (getTrainType != null)
                    {
                        trainTypeId = getTrainType.TrainTypeId;
                    }
                    string unitId = null;
                    if (!string.IsNullOrEmpty(item["TrainDepart"].ToString()))
                    {
                        var lists = Funs.GetStrListByStr(item["TrainDepart"].ToString(), ',');
                        if (lists.Count() > 0)
                        {
                            foreach (var itemList in lists)
                            {
                                var getUnit = db.Base_Unit.FirstOrDefault(x => x.UnitName == itemList);
                                if (getUnit != null)
                                {
                                    if (string.IsNullOrEmpty(unitId))
                                    {
                                        unitId = getUnit.UnitId;
                                    }
                                    else
                                    {
                                        unitId += ("," + getUnit.UnitId);
                                    }
                                }
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(unitId) && !string.IsNullOrEmpty(fromRecordId))
                    {
                        Model.EduTrain_TrainRecord newTrainRecord = new Model.EduTrain_TrainRecord
                        {
                            FromRecordId = fromRecordId,

                            ProjectId      = projectId,
                            TrainTitle     = item["RecordName"].ToString(),
                            TrainContent   = item["TrainContent"].ToString(),
                            TrainStartDate = Funs.GetNewDateTime(item["TrainStartDate"].ToString()),
                            TrainEndDate   = Funs.GetNewDateTime(item["TrainEndDate"].ToString()),
                            TeachHour      = Funs.GetNewDecimalOrZero(item["TrainPeriod"].ToString()),
                            TeachMan       = item["TrainPrincipal"].ToString(),
                            Remark         = item["TrainDescript"].ToString(),
                            TrainTypeId    = trainTypeId,
                            UnitIds        = unitId,
                            States         = Const.State_0,
                            CompileMan     = item["CreateUser"].ToString(),
                            TrainPersonNum = Funs.GetNewInt(item["PersonCount"].ToString()),
                        };

                        newTrainRecord.TrainingCode = Funs.GetNewFileName(newTrainRecord.TrainStartDate);
                        var getTrainRecord = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(x => x.FromRecordId == fromRecordId);
                        if (getTrainRecord == null)
                        {
                            newTrainRecord.TrainingId = SQLHelper.GetNewID(typeof(Model.EduTrain_TrainRecord));
                            EduTrain_TrainRecordService.AddTraining(newTrainRecord);
                            BLL.LogService.AddSys_Log(user, newTrainRecord.TrainingCode, newTrainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnAdd);
                        }
                        else
                        {
                            getTrainRecord.TrainingCode   = newTrainRecord.TrainingCode;
                            getTrainRecord.TrainTitle     = newTrainRecord.TrainTitle;
                            getTrainRecord.TrainContent   = newTrainRecord.TrainContent;
                            getTrainRecord.UnitIds        = newTrainRecord.UnitIds;
                            getTrainRecord.TrainStartDate = newTrainRecord.TrainStartDate;
                            if (newTrainRecord.TrainEndDate.HasValue)
                            {
                                getTrainRecord.TrainEndDate = newTrainRecord.TrainEndDate;
                            }
                            else
                            {
                                getTrainRecord.TrainEndDate = newTrainRecord.TrainStartDate;
                            }
                            getTrainRecord.TeachHour    = newTrainRecord.TeachHour;
                            getTrainRecord.TeachMan     = newTrainRecord.TeachMan;
                            getTrainRecord.TeachAddress = newTrainRecord.TeachAddress;

                            getTrainRecord.Remark = newTrainRecord.Remark;
                            EduTrain_TrainRecordService.UpdateTraining(getTrainRecord);
                            BLL.LogService.AddSys_Log(user, getTrainRecord.TrainingCode, getTrainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnModify);
                        }
                    }
                    else
                    {
                        isOk = false;
                    }
                }
            }
            catch (Exception ex)
            {
                isOk = false;
                ErrLogInfo.WriteLog(string.Empty, ex);
            }
            return(isOk);
        }
示例#18
0
        /// <summary>
        /// 人员资质信息保存方法
        /// </summary>
        /// <param name="personQuality">人员信息</param>
        public static void SavePersonQuality(Model.PersonQualityItem personQuality)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                if (personQuality.QualityType == "1")
                {
                    Model.QualityAudit_PersonQuality newPersonQuality = new Model.QualityAudit_PersonQuality
                    {
                        PersonQualityId = personQuality.PersonQualityId,
                        PersonId        = personQuality.PersonId,
                        CertificateNo   = personQuality.CertificateNo,
                        CertificateName = personQuality.CertificateName,
                        Grade           = personQuality.Grade,
                        SendUnit        = personQuality.SendUnit,
                        SendDate        = Funs.GetNewDateTime(personQuality.SendDate),
                        LimitDate       = Funs.GetNewDateTime(personQuality.LimitDate),
                        LateCheckDate   = Funs.GetNewDateTime(personQuality.LateCheckDate),
                        ApprovalPerson  = personQuality.ApprovalPerson,
                        Remark          = personQuality.Remark,
                        CompileDate     = Funs.GetNewDateTime(personQuality.CompileDate),
                        AuditOpinion    = personQuality.AuditOpinion,
                        States          = personQuality.States,
                    };
                    if (newPersonQuality.States == Const.State_2 || newPersonQuality.States == Const.State_R)
                    {
                        newPersonQuality.AuditDate = DateTime.Now;
                    }
                    else
                    {
                        newPersonQuality.AuditDate = null;
                    }
                    if (!string.IsNullOrEmpty(personQuality.CertificateId))
                    {
                        newPersonQuality.CertificateId = personQuality.CertificateId;
                    }
                    if (!string.IsNullOrEmpty(personQuality.CompileMan))
                    {
                        newPersonQuality.CompileMan = personQuality.CompileMan;
                    }
                    if (!string.IsNullOrEmpty(personQuality.AuditorId))
                    {
                        newPersonQuality.AuditorId = personQuality.AuditorId;
                    }
                    var getPersonQuality = db.QualityAudit_PersonQuality.FirstOrDefault(x => x.PersonQualityId == newPersonQuality.PersonQualityId || x.PersonId == newPersonQuality.PersonId);
                    if (getPersonQuality == null)
                    {
                        newPersonQuality.PersonQualityId = SQLHelper.GetNewID();
                        newPersonQuality.CompileDate     = DateTime.Now;
                        db.QualityAudit_PersonQuality.InsertOnSubmit(newPersonQuality);
                        db.SubmitChanges();
                    }
                    else
                    {
                        newPersonQuality.PersonQualityId = getPersonQuality.PersonQualityId;
                        getPersonQuality.CertificateId   = newPersonQuality.CertificateId;
                        getPersonQuality.CertificateNo   = newPersonQuality.CertificateNo;
                        getPersonQuality.CertificateName = newPersonQuality.CertificateName;
                        getPersonQuality.Grade           = newPersonQuality.Grade;
                        getPersonQuality.SendUnit        = newPersonQuality.SendUnit;
                        getPersonQuality.SendDate        = newPersonQuality.SendDate;
                        getPersonQuality.LimitDate       = newPersonQuality.LimitDate;
                        getPersonQuality.LateCheckDate   = newPersonQuality.LateCheckDate;
                        getPersonQuality.Remark          = newPersonQuality.Remark;
                        getPersonQuality.AuditDate       = newPersonQuality.AuditDate;
                        getPersonQuality.AuditorId       = newPersonQuality.AuditorId;
                        getPersonQuality.States          = newPersonQuality.States;
                        db.SubmitChanges();
                    }
                    if (!string.IsNullOrEmpty(newPersonQuality.PersonQualityId))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.PersonQualityMenuId, newPersonQuality.PersonQualityId, personQuality.AttachUrl, "0");
                    }
                }
                else if (personQuality.QualityType == "2")
                {
                    Model.QualityAudit_SafePersonQuality newSafeQuality = new Model.QualityAudit_SafePersonQuality
                    {
                        SafePersonQualityId = personQuality.PersonQualityId,
                        PersonId            = personQuality.PersonId,
                        CertificateNo       = personQuality.CertificateNo,
                        CertificateName     = personQuality.CertificateName,
                        Grade          = personQuality.Grade,
                        SendUnit       = personQuality.SendUnit,
                        SendDate       = Funs.GetNewDateTime(personQuality.SendDate),
                        LimitDate      = Funs.GetNewDateTime(personQuality.LimitDate),
                        LateCheckDate  = Funs.GetNewDateTime(personQuality.LateCheckDate),
                        ApprovalPerson = personQuality.ApprovalPerson,
                        Remark         = personQuality.Remark,
                        CompileDate    = Funs.GetNewDateTime(personQuality.CompileDate),
                        AuditDate      = Funs.GetNewDateTime(personQuality.AuditDate),
                        AuditOpinion   = personQuality.AuditOpinion,
                        States         = personQuality.States,
                    };
                    if (newSafeQuality.States == Const.State_2 || newSafeQuality.States == Const.State_R)
                    {
                        newSafeQuality.AuditDate = DateTime.Now;
                    }
                    else
                    {
                        newSafeQuality.AuditDate = null;
                    }
                    //if (!string.IsNullOrEmpty(personQuality.CertificateId))
                    //{
                    //    newSafeQuality.CertificateId = personQuality.CertificateId;
                    //}
                    if (!string.IsNullOrEmpty(personQuality.CompileMan))
                    {
                        newSafeQuality.CompileMan = personQuality.CompileMan;
                    }
                    if (!string.IsNullOrEmpty(personQuality.AuditorId))
                    {
                        newSafeQuality.AuditorId = personQuality.AuditorId;
                    }
                    var getSafePersonQuality = db.QualityAudit_SafePersonQuality.FirstOrDefault(x => x.SafePersonQualityId == newSafeQuality.SafePersonQualityId || x.PersonId == newSafeQuality.PersonId);
                    if (getSafePersonQuality == null)
                    {
                        newSafeQuality.SafePersonQualityId = SQLHelper.GetNewID();
                        newSafeQuality.CompileDate         = DateTime.Now;
                        db.QualityAudit_SafePersonQuality.InsertOnSubmit(newSafeQuality);
                        db.SubmitChanges();
                    }
                    else
                    {
                        newSafeQuality.SafePersonQualityId = getSafePersonQuality.SafePersonQualityId;
                        //getPersonQuality.CertificateId = newSafeQuality.CertificateId;
                        getSafePersonQuality.CertificateNo   = newSafeQuality.CertificateNo;
                        getSafePersonQuality.CertificateName = newSafeQuality.CertificateName;
                        getSafePersonQuality.Grade           = newSafeQuality.Grade;
                        getSafePersonQuality.SendUnit        = newSafeQuality.SendUnit;
                        getSafePersonQuality.SendDate        = newSafeQuality.SendDate;
                        getSafePersonQuality.LimitDate       = newSafeQuality.LimitDate;
                        getSafePersonQuality.LateCheckDate   = newSafeQuality.LateCheckDate;
                        getSafePersonQuality.Remark          = newSafeQuality.Remark;
                        getSafePersonQuality.AuditDate       = newSafeQuality.AuditDate;
                        getSafePersonQuality.AuditorId       = newSafeQuality.AuditorId;
                        getSafePersonQuality.States          = newSafeQuality.States;
                        db.SubmitChanges();
                    }
                    if (!string.IsNullOrEmpty(newSafeQuality.SafePersonQualityId))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.SafePersonQualityMenuId, newSafeQuality.SafePersonQualityId, personQuality.AttachUrl, "0");
                    }
                }
                //// 特种设备作业人员
                if (personQuality.QualityType == "3")
                {
                    Model.QualityAudit_EquipmentPersonQuality newEquipmentPersonQuality = new Model.QualityAudit_EquipmentPersonQuality
                    {
                        EquipmentPersonQualityId = personQuality.PersonQualityId,
                        PersonId        = personQuality.PersonId,
                        CertificateNo   = personQuality.CertificateNo,
                        CertificateName = personQuality.CertificateName,
                        Grade           = personQuality.Grade,
                        SendUnit        = personQuality.SendUnit,
                        SendDate        = Funs.GetNewDateTime(personQuality.SendDate),
                        LimitDate       = Funs.GetNewDateTime(personQuality.LimitDate),
                        LateCheckDate   = Funs.GetNewDateTime(personQuality.LateCheckDate),
                        ApprovalPerson  = personQuality.ApprovalPerson,
                        Remark          = personQuality.Remark,
                        CompileDate     = Funs.GetNewDateTime(personQuality.CompileDate),
                        AuditDate       = Funs.GetNewDateTime(personQuality.AuditDate),
                        AuditOpinion    = personQuality.AuditOpinion,
                        States          = personQuality.States,
                    };
                    if (newEquipmentPersonQuality.States == Const.State_2 || newEquipmentPersonQuality.States == Const.State_R)
                    {
                        newEquipmentPersonQuality.AuditDate = DateTime.Now;
                    }
                    else
                    {
                        newEquipmentPersonQuality.AuditDate = null;
                    }
                    if (!string.IsNullOrEmpty(personQuality.CertificateId))
                    {
                        newEquipmentPersonQuality.CertificateId = personQuality.CertificateId;
                    }
                    if (!string.IsNullOrEmpty(personQuality.CompileMan))
                    {
                        newEquipmentPersonQuality.CompileMan = personQuality.CompileMan;
                    }
                    if (!string.IsNullOrEmpty(personQuality.AuditorId))
                    {
                        newEquipmentPersonQuality.AuditorId = personQuality.AuditorId;
                    }
                    var getEquipmentPersonQuality = db.QualityAudit_EquipmentPersonQuality.FirstOrDefault(x => x.EquipmentPersonQualityId == newEquipmentPersonQuality.EquipmentPersonQualityId || x.PersonId == newEquipmentPersonQuality.PersonId);
                    if (getEquipmentPersonQuality == null)
                    {
                        newEquipmentPersonQuality.EquipmentPersonQualityId = SQLHelper.GetNewID();
                        newEquipmentPersonQuality.CompileDate = DateTime.Now;
                        db.QualityAudit_EquipmentPersonQuality.InsertOnSubmit(newEquipmentPersonQuality);
                        db.SubmitChanges();
                    }
                    else
                    {
                        newEquipmentPersonQuality.EquipmentPersonQualityId = getEquipmentPersonQuality.EquipmentPersonQualityId;
                        getEquipmentPersonQuality.CertificateId            = newEquipmentPersonQuality.CertificateId;
                        getEquipmentPersonQuality.CertificateNo            = newEquipmentPersonQuality.CertificateNo;
                        getEquipmentPersonQuality.CertificateName          = newEquipmentPersonQuality.CertificateName;
                        getEquipmentPersonQuality.Grade         = newEquipmentPersonQuality.Grade;
                        getEquipmentPersonQuality.SendUnit      = newEquipmentPersonQuality.SendUnit;
                        getEquipmentPersonQuality.SendDate      = newEquipmentPersonQuality.SendDate;
                        getEquipmentPersonQuality.LimitDate     = newEquipmentPersonQuality.LimitDate;
                        getEquipmentPersonQuality.LateCheckDate = newEquipmentPersonQuality.LateCheckDate;
                        getEquipmentPersonQuality.Remark        = newEquipmentPersonQuality.Remark;
                        getEquipmentPersonQuality.AuditDate     = newEquipmentPersonQuality.AuditDate;
                        getEquipmentPersonQuality.AuditorId     = newEquipmentPersonQuality.AuditorId;
                        getEquipmentPersonQuality.States        = newEquipmentPersonQuality.States;
                        db.SubmitChanges();
                    }
                    if (!string.IsNullOrEmpty(newEquipmentPersonQuality.EquipmentPersonQualityId))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.EquipmentPersonQualityMenuId, newEquipmentPersonQuality.EquipmentPersonQualityId, personQuality.AttachUrl, "0");
                    }
                }

                if (!string.IsNullOrEmpty(personQuality.AuditDate) && string.IsNullOrEmpty(personQuality.AuditorId))
                {
                    APICommonService.SendSubscribeMessage(personQuality.AuditorId, "人员资质" + personQuality.PersonName + "待您审核", personQuality.CompileManName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
            }
        }
示例#19
0
        /// <summary>
        /// 插入试卷 4
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="arr"></param>
        public static bool AddEduTrain_TrainTest(string projectId, JArray arr, Model.Sys_User user)
        {
            Model.SUBHSSEDB db   = Funs.DB;
            bool            isOk = true;

            try
            {
                foreach (var item in arr)
                {
                    string trainingId     = null; ////培训记录ID
                    var    getTrainRecord = db.EduTrain_TrainRecord.FirstOrDefault(x => x.FromRecordId == item["RecordId"].ToString());
                    if (getTrainRecord != null)
                    {
                        trainingId = getTrainRecord.TrainingId;
                    }

                    string trainTestId = item["ID"].ToString();
                    if (!string.IsNullOrEmpty(trainingId) && !string.IsNullOrEmpty(trainTestId))
                    {
                        Model.EduTrain_TrainTest newTrainTest = new Model.EduTrain_TrainTest
                        {
                            TrainTestId  = trainTestId,
                            TrainingId   = trainingId,
                            ExamNo       = item["ExamNo"].ToString(),
                            GroupNo      = item["GroupNo"].ToString(),
                            CourseID     = item["CourseID"].ToString(),
                            COrder       = Funs.GetNewInt(item["COrder"].ToString()),
                            QsnCode      = item["QsnCode"].ToString(),
                            QsnId        = item["QsnId"].ToString(),
                            QsnContent   = item["QsnContent"].ToString(),
                            QsnFileName  = item["QsnFileName"].ToString(),
                            QsnAnswer    = item["QsnAnswer"].ToString(),
                            QsnCategory  = item["QsnCategory"].ToString(),
                            QsnKind      = item["QsnKind"].ToString(),
                            Description  = item["Description"].ToString(),
                            QsnImportant = item["QsnImportant"].ToString(),
                            Analysis     = item["Analysis"].ToString(),
                            UploadTime   = Funs.GetNewDateTime(item["UploadTime"].ToString()),
                        };

                        var getTrainRecordDetail = db.EduTrain_TrainTest.FirstOrDefault(x => x.TrainTestId == trainTestId);
                        if (getTrainRecordDetail == null)
                        {
                            EduTrain_TrainTestService.AddTrainTest(newTrainTest);
                        }
                        else
                        {
                            newTrainTest.ExamNo       = newTrainTest.ExamNo;
                            newTrainTest.GroupNo      = newTrainTest.GroupNo;
                            newTrainTest.CourseID     = newTrainTest.CourseID;
                            newTrainTest.COrder       = newTrainTest.COrder;
                            newTrainTest.QsnCode      = newTrainTest.QsnCode;
                            newTrainTest.QsnId        = newTrainTest.QsnId;
                            newTrainTest.QsnContent   = newTrainTest.QsnContent;
                            newTrainTest.QsnFileName  = newTrainTest.QsnFileName;
                            newTrainTest.QsnAnswer    = newTrainTest.QsnAnswer;
                            newTrainTest.QsnCategory  = newTrainTest.QsnCategory;
                            newTrainTest.QsnKind      = newTrainTest.QsnKind;
                            newTrainTest.Description  = newTrainTest.Description;
                            newTrainTest.QsnImportant = newTrainTest.QsnImportant;
                            newTrainTest.Analysis     = newTrainTest.Analysis;
                            newTrainTest.UploadTime   = newTrainTest.UploadTime;
                            db.SubmitChanges();
                        }
                    }
                    else
                    {
                        isOk = false;
                    }
                }
            }
            catch (Exception ex)
            {
                isOk = false;
                ErrLogInfo.WriteLog(string.Empty, ex);
            }
            return(isOk);
        }
示例#20
0
        /// <summary>
        ///  保存专项检查明细项
        /// </summary>
        /// <param name="newDetail"></param>
        public static void SaveCheckSpecialDetail(Model.CheckSpecialDetailItem newDetail)
        {
            if (!string.IsNullOrEmpty(newDetail.CheckSpecialId))
            {
                Model.Check_CheckSpecialDetail newCheckSpecialDetail = new Model.Check_CheckSpecialDetail
                {
                    CheckSpecialId  = newDetail.CheckSpecialId,
                    CheckItem       = newDetail.CheckItemSetId,
                    CheckItemType   = newDetail.CheckItemSetName,
                    Unqualified     = newDetail.Unqualified,
                    UnitId          = newDetail.UnitId,
                    HandleStep      = newDetail.HandleStep,
                    CompleteStatus  = newDetail.CompleteStatus,
                    RectifyNoticeId = newDetail.RectifyNoticeId,
                    LimitedDate     = Funs.GetNewDateTime(newDetail.LimitedDate),
                    CompletedDate   = Funs.GetNewDateTime(newDetail.CompletedDate),
                    Suggestions     = newDetail.Suggestions,
                    WorkArea        = newDetail.WorkArea,
                    CheckArea       = newDetail.WorkAreaId,
                    CheckContent    = newDetail.CheckContent,
                };
                var getUnit = UnitService.GetUnitByUnitId(newDetail.UnitId);
                if (getUnit != null)
                {
                    newCheckSpecialDetail.UnitId = newDetail.UnitId;
                }

                var updateDetail = Funs.DB.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == newDetail.CheckSpecialDetailId);
                if (updateDetail == null)
                {
                    newCheckSpecialDetail.CheckSpecialDetailId = SQLHelper.GetNewID();
                    Funs.DB.Check_CheckSpecialDetail.InsertOnSubmit(newCheckSpecialDetail);
                    Funs.DB.SubmitChanges();
                }
                else
                {
                    newCheckSpecialDetail.CheckSpecialDetailId = updateDetail.CheckSpecialDetailId;
                    updateDetail.CheckItem       = newCheckSpecialDetail.CheckItem;
                    updateDetail.CheckItemType   = newCheckSpecialDetail.CheckItemType;
                    updateDetail.Unqualified     = newCheckSpecialDetail.Unqualified;
                    updateDetail.UnitId          = newCheckSpecialDetail.UnitId;
                    updateDetail.HandleStep      = newCheckSpecialDetail.HandleStep;
                    updateDetail.CompleteStatus  = newCheckSpecialDetail.CompleteStatus;
                    updateDetail.RectifyNoticeId = newCheckSpecialDetail.RectifyNoticeId;
                    updateDetail.LimitedDate     = newCheckSpecialDetail.LimitedDate;
                    updateDetail.CompletedDate   = newCheckSpecialDetail.CompletedDate;
                    updateDetail.Suggestions     = newCheckSpecialDetail.Suggestions;
                    updateDetail.WorkArea        = newCheckSpecialDetail.WorkArea;
                    updateDetail.CheckContent    = newCheckSpecialDetail.CheckContent;
                    Funs.DB.SubmitChanges();
                }
                ////保存附件
                if (!string.IsNullOrEmpty(newDetail.AttachUrl1))
                {
                    UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newDetail.AttachUrl1, 10, null), newDetail.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecialDetail.CheckSpecialDetailId);
                }
                else
                {
                    CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecialDetail.CheckSpecialDetailId);
                }
            }
        }
示例#21
0
        /// <summary>
        ///  获取当前人按钮集合
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="menuId">按钮id</param>
        /// <returns>是否具有权限</returns>
        public static List <string> GetAllButtonList(string projectId, string userId, string menuId)
        {
            Model.SUBHSSEDB db                    = Funs.DB;
            List <string>   buttonList            = new List <string>();
            List <Model.Sys_ButtonToMenu> buttons = new List <Model.Sys_ButtonToMenu>();

            if (userId == Const.sedinId)
            {
                return(buttonList);
            }
            if (userId == Const.sysglyId || userId == Const.hfnbdId)
            {
                buttons = (from x in db.Sys_ButtonToMenu
                           where x.MenuId == menuId
                           select x).ToList();
            }
            else
            {
                if (string.IsNullOrEmpty(projectId))
                {
                    var user = BLL.UserService.GetUserByUserId(userId); ////用户
                    if (user != null)
                    {
                        buttons = (from x in db.Sys_ButtonToMenu
                                   join y in db.Sys_ButtonPower on x.ButtonToMenuId equals y.ButtonToMenuId
                                   where y.RoleId == user.RoleId && y.MenuId == menuId && x.MenuId == menuId
                                   select x).ToList();
                    }
                }
                else
                {
                    var pUser = BLL.ProjectUserService.GetProjectUserByUserIdProjectId(projectId, userId); ///项目用户
                    if (pUser != null)
                    {
                        List <string> roleIdList = Funs.GetStrListByStr(pUser.RoleId, ',');
                        buttons = (from x in db.Sys_ButtonToMenu
                                   join y in db.Sys_ButtonPower on x.ButtonToMenuId equals y.ButtonToMenuId
                                   where roleIdList.Contains(y.RoleId) && y.MenuId == menuId && x.MenuId == menuId
                                   select x).ToList();
                    }
                }
            }

            if (buttons.Count() > 0)
            {
                if (!CommonService.GetIsBuildUnit())
                {
                    var menu = BLL.SysMenuService.GetSysMenuByMenuId(menuId);
                    if (menu != null && menu.MenuType == BLL.Const.Menu_Resource)
                    {
                        for (int p = buttons.Count - 1; p > -1; p--)
                        {
                            if (buttons[p].ButtonName == BLL.Const.BtnSaveUp || buttons[p].ButtonName == BLL.Const.BtnUploadResources || buttons[p].ButtonName == BLL.Const.BtnAuditing)
                            {
                                buttons.Remove(buttons[p]);
                            }
                        }
                    }
                }

                buttonList = buttons.Select(x => x.ButtonName).ToList();
            }

            if (!String.IsNullOrEmpty(projectId) && menuId != BLL.Const.ProjectShutdownMenuId)
            {
                var porject = BLL.ProjectService.GetProjectByProjectId(projectId);
                if (porject != null && (porject.ProjectState == BLL.Const.ProjectState_2 || porject.ProjectState == BLL.Const.ProjectState_3))
                {
                    buttonList.Clear();
                }
            }
            return(buttonList);
        }
示例#22
0
        /// <summary>
        /// 保存Check_CheckSpecial
        /// </summary>
        /// <param name="newItem">处罚通知单</param>
        /// <returns></returns>
        public static string SaveCheckSpecial(Model.CheckSpecialItem newItem)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                string message = string.Empty;
                Model.Check_CheckSpecial newCheckSpecial = new Model.Check_CheckSpecial
                {
                    CheckSpecialId    = newItem.CheckSpecialId,
                    CheckSpecialCode  = newItem.CheckSpecialCode,
                    CheckItemSetId    = newItem.CheckItemSetId,
                    CheckType         = newItem.CheckType,
                    ProjectId         = newItem.ProjectId,
                    CheckPerson       = newItem.CheckPersonId,
                    CheckTime         = Funs.GetNewDateTime(newItem.CheckTime),
                    DaySummary        = System.Web.HttpUtility.HtmlEncode(newItem.DaySummary),
                    PartInUnits       = newItem.PartInUnitIds,
                    PartInPersonIds   = newItem.PartInPersonIds,
                    PartInPersons     = UserService.getUserNamesUserIds(newItem.PartInPersonIds),
                    PartInPersonNames = newItem.PartInPersonNames2,
                    CompileMan        = newItem.CompileManId,
                    States            = Const.State_2,
                };
                if (newItem.States != "1")
                {
                    newCheckSpecial.States = Const.State_0;
                }

                var updateCheckSpecial = db.Check_CheckSpecial.FirstOrDefault(x => x.CheckSpecialId == newItem.CheckSpecialId);
                if (updateCheckSpecial == null)
                {
                    newCheckSpecial.CheckSpecialId   = SQLHelper.GetNewID();
                    newCheckSpecial.CheckSpecialCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectCheckSpecialMenuId, newCheckSpecial.ProjectId, string.Empty);
                    db.Check_CheckSpecial.InsertOnSubmit(newCheckSpecial);
                    db.SubmitChanges();
                    ////增加一条编码记录
                    BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckSpecialMenuId, newCheckSpecial.ProjectId, null, newCheckSpecial.CheckSpecialId, newCheckSpecial.CheckTime);
                }
                else
                {
                    Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial);
                    //// 删除专项检查明细项
                    Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(newCheckSpecial.CheckSpecialId);
                }
                if (newCheckSpecial.States == "1")
                {
                    CommonService.btnSaveData(newCheckSpecial.ProjectId, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId, newCheckSpecial.CompileMan, true, newCheckSpecial.CheckSpecialCode, "../Check/CheckSpecialView.aspx?CheckSpecialId={0}");
                }
                ////保存附件
                if (!string.IsNullOrEmpty(newItem.AttachUrl1))
                {
                    UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId);
                }
                else
                {
                    CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId);
                }

                ///// 新增检查项
                if (newItem.CheckSpecialDetailItems != null && newItem.CheckSpecialDetailItems.Count() > 0)
                {
                    foreach (var item in newItem.CheckSpecialDetailItems)
                    {
                        item.CheckSpecialId = newCheckSpecial.CheckSpecialId;
                        SaveCheckSpecialDetail(item);
                    }
                    //// 单据完成后 系统自动按照单位 整改要求生成隐患整改单
                    if (newCheckSpecial.States == Const.State_2)
                    {
                        SaveNewRectifyNotices(newItem);
                        message = "已生成整改单,请在隐患整改单待提交中签发!";
                    }
                }
                return(message);
            }
        }
示例#23
0
        /// <summary>
        /// 收集工程师日志记录
        /// </summary>
        /// <param name="projectId">项目id</param>
        /// <param name="menuId">菜单id</param>
        /// <param name="dataId">单据id</param>
        /// <param name="operaterId">操作人id</param>
        /// <param name="date">日期</param>
        public static void CollectHSSELogByData(string projectId, string menuId, string dataId)
        {
            switch (menuId)
            {
            case BLL.Const.ProjectCheckDayMenuId:
                var checkDay = BLL.Check_CheckDayService.GetCheckDayByCheckDayId(dataId);
                if (checkDay != null)
                {
                    BLL.HSSELogService.CollectHSSELog(projectId, checkDay.CheckPerson, checkDay.CheckTime, "21", "日常巡检", Const.BtnAdd, 1);
                }
                break;

            case BLL.Const.ProjectCheckSpecialMenuId:
                var checkSpecial = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(dataId);
                if (checkSpecial != null)
                {
                    BLL.HSSELogService.CollectHSSELog(projectId, checkSpecial.CheckPerson, checkSpecial.CheckTime, "21", "专项检查", Const.BtnAdd, 1);
                    if (!string.IsNullOrEmpty(checkSpecial.PartInPersonIds))
                    {
                        List <string> partInPersonIds = Funs.GetStrListByStr(checkSpecial.PartInPersonIds, ',');
                        foreach (var item in partInPersonIds)
                        {
                            BLL.HSSELogService.CollectHSSELog(projectId, item, checkSpecial.CheckTime, "21", "专项检查", Const.BtnAdd, 1);
                        }
                    }
                }
                break;

            case BLL.Const.ProjectCheckColligationMenuId:
                var checkColligation = BLL.Check_CheckColligationService.GetCheckColligationByCheckColligationId(dataId);
                if (checkColligation != null)
                {
                    BLL.HSSELogService.CollectHSSELog(projectId, checkColligation.CheckPerson, checkColligation.CheckTime, "21", "综合检查", Const.BtnAdd, 1);
                    if (!string.IsNullOrEmpty(checkColligation.PartInPersonIds))
                    {
                        List <string> partInPersonIds = Funs.GetStrListByStr(checkColligation.PartInPersonIds, ',');
                        foreach (var item in partInPersonIds)
                        {
                            BLL.HSSELogService.CollectHSSELog(projectId, item, checkColligation.CheckTime, "21", "综合检查", Const.BtnAdd, 1);
                        }
                    }
                }
                break;

            case BLL.Const.ProjectCheckWorkMenuId:
                var checkWork = BLL.Check_CheckWorkService.GetCheckWorkByCheckWorkId(dataId);
                if (checkWork != null)
                {
                    if (!string.IsNullOrEmpty(checkWork.MainUnitPerson))
                    {
                        List <string> mainUnitPersonIds = Funs.GetStrListByStr(checkWork.MainUnitPerson, ',');
                        foreach (var item in mainUnitPersonIds)
                        {
                            BLL.HSSELogService.CollectHSSELog(projectId, item, checkWork.CheckTime, "21", "开工前HSE检查", Const.BtnAdd, 1);
                        }
                    }
                    if (!string.IsNullOrEmpty(checkWork.SubUnitPerson))
                    {
                        List <string> subUnitPersonIds = Funs.GetStrListByStr(checkWork.SubUnitPerson, ',');
                        foreach (var item in subUnitPersonIds)
                        {
                            BLL.HSSELogService.CollectHSSELog(projectId, item, checkWork.CheckTime, "21", "开工前HSE检查", Const.BtnAdd, 1);
                        }
                    }
                }
                break;

            case BLL.Const.ProjectCheckHolidayMenuId:
                var checkHoliday = BLL.Check_CheckHolidayService.GetCheckHolidayByCheckHolidayId(dataId);
                if (checkHoliday != null)
                {
                    if (!string.IsNullOrEmpty(checkHoliday.MainUnitPerson))
                    {
                        List <string> mainUnitPersonIds = Funs.GetStrListByStr(checkHoliday.MainUnitPerson, ',');
                        foreach (var item in mainUnitPersonIds)
                        {
                            BLL.HSSELogService.CollectHSSELog(projectId, item, checkHoliday.CheckTime, "21", "季节性和节假日前HSE检查", Const.BtnAdd, 1);
                        }
                    }
                    if (!string.IsNullOrEmpty(checkHoliday.SubUnitPerson))
                    {
                        List <string> subUnitPersonIds = Funs.GetStrListByStr(checkHoliday.SubUnitPerson, ',');
                        foreach (var item in subUnitPersonIds)
                        {
                            BLL.HSSELogService.CollectHSSELog(projectId, item, checkHoliday.CheckTime, "21", "季节性和节假日前HSE检查", Const.BtnAdd, 1);
                        }
                    }
                }
                break;
            }
        }
示例#24
0
        /// <summary>
        /// 生成安全资料计划总表 方法
        /// </summary>
        /// <param name="project"></param>
        /// <param name="safetyDataEnd"></param>
        public static void GetSafetyDataPlanMethod(Model.Base_Project project, List <Model.SafetyData_SafetyData> safetyDataEnd, DateTime?startTime, DateTime?endTime)
        {
            ////第一步 判断是否存在此项目的计划表
            ////第二步 不存在增加这个项目时间范围内的 存在取不存在时间段
            ////第三步 项目时间 是否为空? 现在默认都不能为空
            Model.SUBHSSEDB db         = Funs.DB;
            string          projectId  = project.ProjectId;
            DateTime        startDatep = project.StartDate.HasValue ? project.StartDate.Value : System.DateTime.Now;

            if (startTime.HasValue)
            {
                startDatep = startTime.Value;
            }
            DateTime startDate = startDatep;
            DateTime endDate   = project.EndDate.HasValue ? project.EndDate.Value : System.DateTime.Now.AddMonths(6);

            if (endTime.HasValue)
            {
                endDate = endTime.Value;
            }
            DeleteSafetyDataPlanByProjectDateId(projectId, endDate);   ///删除竣工后的考核计划
            foreach (var item in safetyDataEnd)
            {
                var safetyDataPlan = db.SafetyData_SafetyDataPlan.FirstOrDefault(x => x.ProjectId == project.ProjectId && x.SafetyDataId == item.SafetyDataId && (x.IsManual == null || x.IsManual == false));
                if (safetyDataPlan != null)
                {
                    ///取结束时间 最大值作为开始时间
                    DateTime maxEndDate = Funs.DB.SafetyData_SafetyDataPlan.Where(x => x.ProjectId == projectId && x.RealEndDate.HasValue && x.SafetyDataId == item.SafetyDataId).Select(x => x.RealEndDate.Value).Max();
                    if (endDate > maxEndDate) ////如果计划单最大时间小于项目结束时间 则追加时间 否则删去
                    {
                        startDate = maxEndDate;
                    }
                    else
                    { ///项目提前结束 则删除计划时间
                        var delSafetyDataPlan = from x in db.SafetyData_SafetyDataPlan where x.RealEndDate > endDate && x.SafetyDataId == item.SafetyDataId select x;
                        if (delSafetyDataPlan.Count() > 0)
                        {
                            db.SafetyData_SafetyDataPlan.DeleteAllOnSubmit(delSafetyDataPlan);
                        }
                    }
                }
                ////算出 开始、结束时间跨度 然后循环增加一个月 并把在此时间段的 考核项写入计划表
                for (int i = 0; startDate.AddMonths(i) <= endDate; i++)
                {
                    Model.SafetyData_SafetyDataPlan newSafetyDataPlan = new Model.SafetyData_SafetyDataPlan
                    {
                        SafetyDataPlanId = SQLHelper.GetNewID(typeof(Model.SafetyData_SafetyDataPlan)),
                        ProjectId        = projectId,
                        SafetyDataId     = item.SafetyDataId,
                        Score            = item.Score,
                        ShouldScore      = item.Score,
                        Remark           = item.Remark,
                    };

                    int monthValue = 0;  ///设置月数
                    if (item.CheckTypeValue1.HasValue)
                    {
                        monthValue = item.CheckTypeValue1.Value;
                    }

                    int dateValue = 1;  ///设置天
                    if (item.CheckTypeValue2.HasValue)
                    {
                        dateValue = item.CheckTypeValue2.Value;
                        if (dateValue > 30)
                        {
                            dateValue = 30;
                        }
                    }

                    ////TODO:通过判断是月报、季报、定时报等情况 是否落在 当前时间范围内 写入到计划总表
                    if (item.CheckType == BLL.Const.SafetyDataCheckType_1) /// 月报
                    {
                        if (startDate.AddMonths(i + monthValue).Month == 2 && dateValue > 28)
                        {
                            dateValue = 28;
                        }
                        DateTime?checkDate = Funs.GetNewDateTime(startDate.AddMonths(i + monthValue).Year + "-" + startDate.AddMonths(i + monthValue).Month + "-" + dateValue);
                        if (checkDate.HasValue && checkDate <= endDate && checkDate >= startDatep)
                        {
                            newSafetyDataPlan.CheckDate     = checkDate;
                            newSafetyDataPlan.RealStartDate = checkDate.Value.AddMonths(-1); ///月报开始日期
                            newSafetyDataPlan.RealStartDate = new DateTime(newSafetyDataPlan.RealStartDate.Value.Year, newSafetyDataPlan.RealStartDate.Value.Month, 1);
                            newSafetyDataPlan.RealEndDate   = newSafetyDataPlan.RealStartDate.Value.AddMonths(1).AddDays(-1);
                        }
                    }
                    else if (item.CheckType == BLL.Const.SafetyDataCheckType_2)                                                                                               /// 季报
                    {
                        int month = startDate.AddMonths(i).Month;                                                                                                             ///当前月份
                        if ((month == 3 + monthValue) || (month == 6 + monthValue) || (month == 9 + monthValue) || (month == monthValue) || (month == 12 && monthValue == 0)) ///考核季度时间
                        {
                            if (startDate.AddMonths(i + monthValue).Month == 2 && dateValue > 28)
                            {
                                dateValue = 28;
                            }
                            DateTime?checkDate = Funs.GetNewDateTime(startDate.AddMonths(i).Year + "-" + startDate.AddMonths(i).Month + "-" + dateValue);
                            if ((month == monthValue) && monthValue != 0)
                            {
                                checkDate = checkDate.Value.AddYears(1);
                            }

                            if (checkDate.HasValue && checkDate <= endDate && checkDate >= startDatep)
                            {
                                newSafetyDataPlan.CheckDate     = checkDate;
                                newSafetyDataPlan.RealStartDate = checkDate.Value.AddMonths(-3); ///开始日期
                                newSafetyDataPlan.RealStartDate = new DateTime(newSafetyDataPlan.RealStartDate.Value.Year, newSafetyDataPlan.RealStartDate.Value.Month, 1);
                                newSafetyDataPlan.RealEndDate   = newSafetyDataPlan.RealStartDate.Value.AddMonths(3).AddDays(-1);
                            }
                        }
                    }
                    else if (item.CheckType == BLL.Const.SafetyDataCheckType_3) /// 定时
                    {
                        if (startDate.AddMonths(i).Month == monthValue)         ///定时月份
                        {
                            if (startDate.AddMonths(i + monthValue).Month == 2 && dateValue > 28)
                            {
                                dateValue = 28;
                            }
                            DateTime?checkDate = Funs.GetNewDateTime(startDate.AddMonths(i).Year + "-" + startDate.AddMonths(i).Month + "-" + dateValue);
                            if (checkDate.HasValue && checkDate <= endDate && checkDate >= startDatep)
                            {
                                newSafetyDataPlan.CheckDate     = checkDate;
                                newSafetyDataPlan.RealStartDate = checkDate.Value.AddMonths(-12); ///开始日期
                                newSafetyDataPlan.RealStartDate = new DateTime(newSafetyDataPlan.RealStartDate.Value.Year, newSafetyDataPlan.RealStartDate.Value.Month, 1);
                                newSafetyDataPlan.RealEndDate   = checkDate.Value;
                            }
                        }
                    }
                    else if (item.CheckType == BLL.Const.SafetyDataCheckType_4) /// 开工后报
                    {
                        DateTime?checkDate = startDate.AddMonths(i);
                        if (checkDate.HasValue && checkDate <= endDate && BLL.Funs.CompareMonths(startDatep, checkDate.Value) == monthValue && checkDate >= startDatep)
                        {
                            newSafetyDataPlan.CheckDate     = checkDate;
                            newSafetyDataPlan.RealStartDate = startDate; ///开始日期
                            newSafetyDataPlan.RealEndDate   = checkDate.Value;
                        }
                    }
                    else if (item.CheckType == BLL.Const.SafetyDataCheckType_5) /// 半年报
                    {
                        if (startDate.AddMonths(i).Month == monthValue || startDate.AddMonths(i).Month == monthValue + 6)
                        {
                            if (startDate.AddMonths(i + monthValue).Month == 2 && dateValue > 28)
                            {
                                dateValue = 28;
                            }
                            DateTime?checkDate = Funs.GetNewDateTime(startDate.AddMonths(i).Year + "-" + startDate.AddMonths(i).Month + "-" + dateValue);
                            if (checkDate.HasValue && checkDate <= endDate && checkDate >= startDatep)
                            {
                                newSafetyDataPlan.CheckDate     = checkDate;
                                newSafetyDataPlan.RealStartDate = checkDate.Value.AddMonths(-6); ///开始日期
                                newSafetyDataPlan.RealStartDate = new DateTime(newSafetyDataPlan.RealStartDate.Value.Year, newSafetyDataPlan.RealStartDate.Value.Month, 1);
                                newSafetyDataPlan.RealEndDate   = newSafetyDataPlan.RealStartDate.Value.AddMonths(6).AddDays(-1);
                            }
                        }
                    }
                    else  /// 其他
                    {
                        if (monthValue > 0 && startDate.AddMonths(i).Year == System.DateTime.Now.Year && startDate.AddMonths(i).Month == monthValue)
                        {
                            if (startDate.AddMonths(i + monthValue).Month == 2 && dateValue > 28)
                            {
                                dateValue = 28;
                            }
                            DateTime?checkDate = Funs.GetNewDateTime(startDate.AddMonths(i).Year + "-" + startDate.AddMonths(i).Month + "-" + dateValue);
                            if (checkDate.HasValue && checkDate <= endDate && checkDate >= startDatep)
                            {
                                newSafetyDataPlan.CheckDate     = checkDate;
                                newSafetyDataPlan.RealStartDate = startDate; ///开始日期
                                newSafetyDataPlan.RealStartDate = new DateTime(newSafetyDataPlan.RealStartDate.Value.Year, newSafetyDataPlan.RealStartDate.Value.Month, 1);
                                newSafetyDataPlan.RealEndDate   = checkDate.Value;
                            }
                        }
                    }
                    if (newSafetyDataPlan.RealEndDate.HasValue)
                    {
                        newSafetyDataPlan.ReminderDate = newSafetyDataPlan.CheckDate.Value.AddDays(-7);
                        AddSafetyDataPlan(newSafetyDataPlan);
                    }
                }
            }
        }
示例#25
0
        /// <summary>
        /// 用户登录成功方法
        /// </summary>
        /// <param name="loginname">登录成功名</param>
        /// <param name="password">未加密密码</param>
        /// <param name="rememberMe">记住我开关</param>
        /// <param name="page">调用页面</param>
        /// <returns>是否登录成功</returns>
        public static bool UserLogOn(string account, string password, bool rememberMe, System.Web.UI.Page page)
        {
            var getUser = from x in Funs.DB.Sys_User where x.Account == account && x.IsPost == true && x.Password == Funs.EncryptionPassword(password)
                          select new { x.UserId, x.UserName, x.Account, x.Password, SystemType = string.Empty, x.IsPost, x.LoginProjectId, LoginSystemType = string.Empty };

            ///安全登录
            if (getUser.Count() == 0)
            {
                getUser = from x in FunsHSSE.DB.Sys_User
                          where x.Account == account && x.IsPost == true && x.Password == Funs.EncryptionPassword(password)
                          select new { x.UserId, x.UserName, x.Account, x.Password, SystemType = string.Empty, x.IsPost, x.LoginProjectId, LoginSystemType = string.Empty };
                ///焊接登录
                if (getUser.Count() == 0)
                {
                    getUser = from x in FunsHJGL.DB.Sys_User
                              where x.Account == account && x.IsPost == true && x.Password == Funs.EncryptionPassword(password)
                              select new { x.UserId, x.UserName, x.Account, x.Password, SystemType = string.Empty, x.IsPost, LoginProjectId = string.Empty, LoginSystemType = string.Empty };
                    ///质量登录
                    if (getUser.Count() == 0)
                    {
                        getUser = from x in FunsCQMS.DB.Sys_User
                                  where x.Account == account && x.IsPost == true && x.Password == Funs.EncryptionPassword(password)
                                  select new { x.UserId, x.UserName, x.Account, x.Password, SystemType = string.Empty, x.IsPost, LoginProjectId = string.Empty, LoginSystemType = string.Empty };
                        ///施工技术登录
                        if (getUser.Count() == 0)
                        {
                            getUser = from x in FunsSGJS.DB.Sys_User
                                      where x.Account == account && x.IsPost == true && x.Password == Funs.EncryptionPassword(password)
                                      select new { x.UserId, x.UserName, x.Account, x.Password, SystemType = string.Empty, x.IsPost, LoginProjectId = string.Empty, LoginSystemType = string.Empty };
                            ///施工综合登录
                            if (getUser.Count() == 0)
                            {
                                getUser = from x in FunsZHGL.DB.Sys_User
                                          where x.Account == account && x.IsPost == true && x.Password == Funs.EncryptionPassword(password)
                                          select new { x.UserId, x.UserName, x.Account, x.Password, SystemType = string.Empty, x.IsPost, LoginProjectId = string.Empty, LoginSystemType = string.Empty };
                            }
                        }
                    }
                }
            }
            var firstUser = getUser.FirstOrDefault();

            if (firstUser != null)
            {
                Model.SpSysUserItem userItem = new Model.SpSysUserItem
                {
                    UserId   = firstUser.UserId,
                    UserName = firstUser.UserName,
                    Account  = firstUser.Account,
                    Password = firstUser.Password,
                };

                FormsAuthentication.SetAuthCookie(account, false);
                page.Session[SessionName.CurrUser] = userItem;
                if (rememberMe)
                {
                    System.Web.HttpCookie u = new System.Web.HttpCookie("UserInfo");
                    u["username"] = account;
                    u["password"] = password;
                    // Cookies过期时间设置为一年.
                    u.Expires = DateTime.Now.AddYears(1);
                    page.Response.Cookies.Add(u);
                }
                else
                {
                    // 当选择不保存用户名时,Cookies过期时间设置为昨天.
                    page.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddDays(-1);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#26
0
        /// <summary>
        /// 附件上传 同时上传到服务器端
        /// </summary>
        /// <param name="fileUpload">上传控件</param>
        /// <param name="fileUrl">上传路径</param>
        /// <param name="constUrl">定义路径</param>
        /// <param name="serverUrl">服务端地址</param>
        /// <returns></returns>
        public static string UploadAttachmentAndServer(string rootPath, FileUpload fileUpload, string fileUrl, string constUrl, string serverUrl)
        {
            string initFullPath = rootPath + constUrl;

            if (!Directory.Exists(initFullPath))
            {
                Directory.CreateDirectory(initFullPath);
            }

            string initFullPathServer = serverUrl + constUrl;

            if (!Directory.Exists(initFullPathServer))
            {
                Directory.CreateDirectory(initFullPathServer);
            }

            string filePath       = fileUpload.PostedFile.FileName;
            string fileName       = Funs.GetNewFileName() + "~" + Path.GetFileName(filePath);
            int    count          = fileUpload.PostedFile.ContentLength;
            string savePath       = constUrl + fileName;
            string fullPath       = initFullPath + fileName;
            string fullPathServer = initFullPathServer + fileName;

            if (!File.Exists(fullPath))
            {
                byte[] buffer = new byte[count];
                Stream stream = fileUpload.PostedFile.InputStream;

                stream.Read(buffer, 0, count);
                MemoryStream memoryStream = new MemoryStream(buffer);
                FileStream   fs           = new FileStream(fullPath, FileMode.Create, FileAccess.Write);
                memoryStream.WriteTo(fs);
                memoryStream.Flush();
                memoryStream.Close();
                fs.Flush();
                fs.Close();
                memoryStream = null;
                fs           = null;
                if (!string.IsNullOrEmpty(fileUrl))
                {
                    fileUrl += "," + savePath;
                }
                else
                {
                    fileUrl += savePath;
                }

                MemoryStream memoryStreamEng = new MemoryStream(buffer);
                FileStream   fsServer        = new FileStream(fullPathServer, FileMode.Create, FileAccess.Write);
                memoryStreamEng.WriteTo(fsServer);
                memoryStreamEng.Flush();
                memoryStreamEng.Close();
                fsServer.Flush();
                fsServer.Close();
                memoryStreamEng = null;
                fsServer        = null;
            }
            else
            {
                fileUrl = string.Empty;
            }

            return(fileUrl);
        }
示例#27
0
        /// <summary>
        /// 用户登录成功方法
        /// </summary>
        /// <param name="loginname">登录成功名</param>
        /// <param name="password">未加密密码</param>
        /// <param name="rememberMe">记住我开关</param>
        /// <param name="page">调用页面</param>
        /// <returns>是否登录成功</returns>
        public static bool UserLogOn(string account, string password, bool rememberMe, System.Web.UI.Page page)
        {
            List <Model.Sys_User> x = (from y in Funs.DB.Sys_User
                                       where y.Account == account && y.IsPost == true && y.Password == Funs.EncryptionPassword(password)
                                       select y).ToList();

            if (x.Any())
            {
                string accValue = HttpUtility.UrlEncode(account);
                FormsAuthentication.SetAuthCookie(accValue, false);
                page.Session[SessionName.CurrUser] = x.First();
                if (rememberMe)
                {
                    System.Web.HttpCookie u = new System.Web.HttpCookie("UserInfo");
                    u["username"] = accValue;
                    u["password"] = password;
                    // Cookies过期时间设置为一月.
                    u.Expires = DateTime.Now.AddMonths(1);
                    page.Response.Cookies.Add(u);
                }
                else
                {
                    // 当选择不保存用户名时,Cookies过期时间设置为昨天.
                    page.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddDays(-1);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#28
0
        /// <summary>
        /// 保存Check_PauseNotice
        /// </summary>
        /// <param name="newItem">工程暂停令</param>
        /// <returns></returns>
        public static void SavePauseNotice(Model.PauseNoticeItem newItem)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                Model.Check_PauseNotice newPauseNotice = new Model.Check_PauseNotice
                {
                    PauseNoticeId   = newItem.PauseNoticeId,
                    PauseNoticeCode = newItem.PauseNoticeCode,
                    ProjectId       = newItem.ProjectId,
                    UnitId          = newItem.UnitId,
                    ProjectPlace    = newItem.ProjectPlace,
                    WrongContent    = newItem.WrongContent,
                    PauseTime       = Funs.GetNewDateTime(newItem.PauseTime),
                    PauseContent    = newItem.PauseContent,
                    OneContent      = newItem.OneContent,
                    SecondContent   = newItem.SecondContent,
                    ThirdContent    = newItem.ThirdContent,
                    States          = Const.State_0,
                    PauseStates     = newItem.PauseStates,
                };

                var getUpdate = db.Check_PauseNotice.FirstOrDefault(x => x.PauseNoticeId == newItem.PauseNoticeId);
                if (getUpdate == null)
                {
                    newPauseNotice.CompileDate     = DateTime.Now;
                    newPauseNotice.PauseNoticeId   = SQLHelper.GetNewID();
                    newPauseNotice.PauseNoticeCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectPauseNoticeMenuId, newPauseNotice.ProjectId, newPauseNotice.UnitId);
                    db.Check_PauseNotice.InsertOnSubmit(newPauseNotice);
                    db.SubmitChanges();

                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectPauseNoticeMenuId, newPauseNotice.ProjectId, newPauseNotice.UnitId, newPauseNotice.PauseNoticeId, newPauseNotice.CompileDate);
                    //// 回写巡检记录表
                    if (!string.IsNullOrEmpty(newItem.HazardRegisterId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(newItem.HazardRegisterId, ',');
                        foreach (var item in listIds)
                        {
                            var getHazardRegister = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == item);
                            if (getHazardRegister != null)
                            {
                                getHazardRegister.States      = "3";
                                getHazardRegister.HandleIdea += "已下发工程暂停令:" + newPauseNotice.PauseNoticeCode;
                                getHazardRegister.ResultId    = newPauseNotice.PauseNoticeId;
                                getHazardRegister.ResultType  = "3";
                                Funs.SubmitChanges();
                            }
                        }
                    }
                    //// 回写专项检查明细表
                    if (!string.IsNullOrEmpty(newItem.CheckSpecialDetailId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(newItem.CheckSpecialDetailId, ',');
                        foreach (var item in listIds)
                        {
                            var getCheckSpecialDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == item);
                            if (getCheckSpecialDetail != null)
                            {
                                getCheckSpecialDetail.DataType = "3";
                                getCheckSpecialDetail.DataId   = newPauseNotice.PauseNoticeId;
                                db.SubmitChanges();
                            }
                        }
                    }
                }
                else
                {
                    newPauseNotice.PauseNoticeId = getUpdate.PauseNoticeId;
                    getUpdate.PauseStates        = newItem.PauseStates;
                    if (newPauseNotice.PauseStates == "0" || newPauseNotice.PauseStates == "1")  ////编制人 修改或提交
                    {
                        getUpdate.UnitId        = newPauseNotice.UnitId;
                        getUpdate.ProjectPlace  = newPauseNotice.ProjectPlace;
                        getUpdate.WrongContent  = newPauseNotice.WrongContent;
                        getUpdate.PauseTime     = newPauseNotice.PauseTime;
                        getUpdate.PauseContent  = newPauseNotice.PauseContent;
                        getUpdate.OneContent    = newPauseNotice.OneContent;
                        getUpdate.SecondContent = newPauseNotice.SecondContent;
                        getUpdate.ThirdContent  = newPauseNotice.ThirdContent;
                        if (newPauseNotice.PauseStates == "1" && !string.IsNullOrEmpty(newItem.SignManId))
                        {
                            getUpdate.SignManId = newItem.SignManId;
                        }
                        else
                        {
                            newPauseNotice.PauseStates = getUpdate.PauseStates = "0";
                        }
                    }
                    else if (newPauseNotice.PauseStates == "2") ////【签发】总包安全经理
                    {
                        /// 不同意 打回 同意抄送专业工程师、施工经理、相关施工分包单位并提交【批准】总包项目经理
                        if (newItem.IsAgree == false)
                        {
                            newPauseNotice.PauseStates = getUpdate.PauseStates = "0";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(newItem.ProfessionalEngineerId))
                            {
                                getUpdate.ProfessionalEngineerId = newItem.ProfessionalEngineerId;
                            }
                            if (!string.IsNullOrEmpty(newItem.ConstructionManagerId))
                            {
                                getUpdate.ConstructionManagerId = newItem.ConstructionManagerId;
                            }
                            if (!string.IsNullOrEmpty(newItem.UnitHeadManId))
                            {
                                getUpdate.UnitHeadManId = newItem.UnitHeadManId;
                            }
                            if (!string.IsNullOrEmpty(newItem.SupervisorManId))
                            {
                                getUpdate.SupervisorManId = newItem.SupervisorManId;
                            }
                            if (!string.IsNullOrEmpty(newItem.OwnerId))
                            {
                                getUpdate.OwnerId = newItem.OwnerId;
                            }
                            if (!string.IsNullOrEmpty(newItem.ApproveManId))
                            {
                                getUpdate.ApproveManId = newItem.ApproveManId;
                                getUpdate.SignDate     = DateTime.Now;
                            }
                            else
                            {
                                newPauseNotice.PauseStates = getUpdate.States = "1";
                            }
                        }
                    }
                    else if (newPauseNotice.PauseStates == "3") ////【批准】总包项目经理
                    {
                        /// 不同意 打回 同意下发【回执】施工分包单位
                        if (newItem.IsAgree == false || string.IsNullOrEmpty(newItem.DutyPersonId))
                        {
                            newPauseNotice.PauseStates = getUpdate.PauseStates = "1";
                        }
                        else
                        {
                            getUpdate.DutyPersonId = newItem.DutyPersonId;
                            getUpdate.ApproveDate  = DateTime.Now;
                            getUpdate.IsConfirm    = true;
                        }
                    }
                    else if (newPauseNotice.PauseStates == "4") ////【批准】总包项目经理
                    {
                        getUpdate.DutyPersonDate = DateTime.Now;
                        getUpdate.States         = Const.State_2;
                    }

                    db.SubmitChanges();
                }

                if (newItem.PauseStates == Const.State_0 || newItem.PauseStates == Const.State_1)
                {     //// 通知单附件
                    UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.PauseNoticeAttachUrl, 10, null), newItem.PauseNoticeAttachUrl, Const.ProjectPauseNoticeMenuId, newPauseNotice.PauseNoticeId);
                }
                if (getUpdate != null && getUpdate.States == Const.State_2)
                {
                    CommonService.btnSaveData(newPauseNotice.ProjectId, Const.ProjectPauseNoticeMenuId, newPauseNotice.PauseNoticeId, newPauseNotice.CompileManId, true, newPauseNotice.PauseContent, "../Check/PauseNoticeView.aspx?PauseNoticeId={0}");

                    var getcheck = from x in db.Check_CheckSpecialDetail where x.DataId == getUpdate.PauseNoticeId select x;
                    if (getcheck.Count() > 0)
                    {
                        foreach (var item in getcheck)
                        {
                            item.CompleteStatus = true;
                            item.CompletedDate  = DateTime.Now;
                            db.SubmitChanges();
                        }
                    }
                }
            }
        }