示例#1
0
        /// <summary>
        /// 保存Check_PunishNotice
        /// </summary>
        /// <param name="newItem">处罚通知单</param>
        /// <returns></returns>
        public static void SavePunishNotice(Model.PunishNoticeItem newItem)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                Model.Check_PunishNotice newPunishNotice = new Model.Check_PunishNotice
                {
                    PunishNoticeId   = newItem.PunishNoticeId,
                    PunishNoticeCode = newItem.PunishNoticeCode,
                    ProjectId        = newItem.ProjectId,
                    PunishNoticeDate = Funs.GetNewDateTime(newItem.PunishNoticeDate),
                    UnitId           = newItem.UnitId,
                    ContractNum      = newItem.ContractNum,
                    IncentiveReason  = newItem.IncentiveReason,
                    BasicItem        = newItem.BasicItem,
                    PunishMoney      = newItem.PunishMoney,
                    Currency         = newItem.Currency,
                    FileContents     = System.Web.HttpUtility.HtmlEncode(newItem.FileContents),
                    States           = Const.State_0,
                    PunishStates     = newItem.PunishStates,
                };

                if (!string.IsNullOrEmpty(newItem.CompileManId))
                {
                    newPunishNotice.CompileMan = newItem.CompileManId;
                }
                if (newPunishNotice.PunishStates == Const.State_1)
                {
                    newPunishNotice.SignMan = newItem.SignManId;
                }

                var getUpdate = db.Check_PunishNotice.FirstOrDefault(x => x.PunishNoticeId == newItem.PunishNoticeId);
                if (getUpdate == null)
                {
                    newPunishNotice.CompileDate      = DateTime.Now;
                    newPunishNotice.PunishNoticeId   = SQLHelper.GetNewID();
                    newPunishNotice.PunishNoticeCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectPunishNoticeMenuId, newPunishNotice.ProjectId, newPunishNotice.UnitId);
                    db.Check_PunishNotice.InsertOnSubmit(newPunishNotice);
                    db.SubmitChanges();
                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectPunishNoticeMenuId, newPunishNotice.ProjectId, newPunishNotice.UnitId, newPunishNotice.PunishNoticeId, newPunishNotice.CompileDate);

                    //// 回写巡检记录表
                    if (!string.IsNullOrEmpty(newItem.HazardRegisterId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(newItem.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 += "已下发处罚通知单:" + newPunishNotice.PunishNoticeCode;
                                getHazardRegister.ResultId    = newPunishNotice.PunishNoticeId;
                                getHazardRegister.ResultType  = "2";
                                db.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 = "2";
                                getCheckSpecialDetail.DataId   = newPunishNotice.PunishNoticeId;
                                db.SubmitChanges();
                            }
                        }
                    }
                }
                else
                {
                    newPunishNotice.PunishNoticeId = getUpdate.PunishNoticeId;
                    getUpdate.PunishStates         = newItem.PunishStates;
                    if (newPunishNotice.PunishStates == "0" || newPunishNotice.PunishStates == "1")  ////编制人 修改或提交
                    {
                        getUpdate.PunishNoticeDate = newPunishNotice.PunishNoticeDate;
                        getUpdate.UnitId           = newPunishNotice.UnitId;
                        getUpdate.ContractNum      = newPunishNotice.ContractNum;
                        getUpdate.IncentiveReason  = newPunishNotice.IncentiveReason;
                        getUpdate.BasicItem        = newPunishNotice.BasicItem;
                        getUpdate.PunishMoney      = newPunishNotice.PunishMoney;
                        getUpdate.Currency         = newPunishNotice.Currency;
                        getUpdate.FileContents     = newPunishNotice.FileContents;
                        if (newPunishNotice.PunishStates == "1" && !string.IsNullOrEmpty(newItem.SignManId))
                        {
                            getUpdate.SignMan = newItem.SignManId;
                        }
                        else
                        {
                            newPunishNotice.PunishStates = getUpdate.PunishStates = "0";
                        }
                        db.SubmitChanges();
                    }
                    else if (newPunishNotice.PunishStates == "2") ////【签发】总包安全经理
                    {
                        /// 不同意 打回 同意抄送专业工程师、施工经理、相关施工分包单位并提交【批准】总包项目经理
                        if (newItem.IsAgree == false)
                        {
                            newPunishNotice.PunishStates = getUpdate.PunishStates = "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.ApproveManId))
                            {
                                getUpdate.ApproveMan = newItem.ApproveManId;
                                getUpdate.SignDate   = DateTime.Now;
                            }
                            else
                            {
                                newPunishNotice.PunishStates = getUpdate.States = "1";
                            }
                        }
                        db.SubmitChanges();
                    }
                    else if (newPunishNotice.PunishStates == "3") ////【批准】总包项目经理
                    {
                        /// 不同意 打回 同意下发【回执】施工分包单位
                        if (newItem.IsAgree == false || string.IsNullOrEmpty(newItem.DutyPersonId))
                        {
                            newPunishNotice.PunishStates = getUpdate.PunishStates = "1";
                        }
                        else
                        {
                            getUpdate.DutyPersonId = newItem.DutyPersonId;
                            getUpdate.ApproveDate  = DateTime.Now;
                        }
                        db.SubmitChanges();
                    }
                    else if (newPunishNotice.PunishStates == "4") ////【批准】总包项目经理
                    {
                        /// 不同意 打回 同意下发【回执】施工分包单位
                        if (string.IsNullOrEmpty(newItem.ReceiptUrl))
                        {
                            newPunishNotice.PunishStates = getUpdate.PunishStates = "3";
                        }
                        else
                        {
                            getUpdate.DutyPersonDate = DateTime.Now;
                            getUpdate.States         = Const.State_2;
                        }
                        db.SubmitChanges();
                    }
                }

                if (newItem.PunishStates == Const.State_0 || newItem.PunishStates == Const.State_1)
                {     //// 通知单附件
                    APIUpLoadFileService.SaveAttachUrl(Const.ProjectPunishNoticeStatisticsMenuId, newPunishNotice.PunishNoticeId, newItem.PunishUrl, "0");
                }
                if (newItem.PunishStates == Const.State_4)
                {     //// 回执单附件
                    APIUpLoadFileService.SaveAttachUrl(Const.ProjectPunishNoticeMenuId, newPunishNotice.PunishNoticeId, newItem.ReceiptUrl, "0");
                }
                if (getUpdate != null && getUpdate.States == Const.State_2)
                {
                    CommonService.btnSaveData(newPunishNotice.ProjectId, Const.ProjectPunishNoticeMenuId, newPunishNotice.PunishNoticeId, newPunishNotice.CompileMan, true, newPunishNotice.PunishNoticeCode, "../Check/PunishNoticeView.aspx?PunishNoticeId={0}");
                    var getcheck = from x in db.Check_CheckSpecialDetail where x.DataId == getUpdate.PunishNoticeId select x;
                    if (getcheck.Count() > 0)
                    {
                        foreach (var item in getcheck)
                        {
                            item.CompleteStatus = true;
                            item.CompletedDate  = DateTime.Now;
                            db.SubmitChanges();
                        }
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// 获取考生信息
 /// </summary>
 /// <param name="testPlanId"></param>
 /// <param name="testManId"></param>
 /// <param name="userType"></param>
 /// <param name="identityCard"></param>
 /// <returns></returns>
 public static Model.TestRecordItem getTestRecordInfo(string testPlanId, string testManId, string userType, string identityCard)
 {
     using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
     {
         Model.TestRecordItem newTestRecord = new Model.TestRecordItem();
         var getTestPlan = db.Test_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId);
         if (getTestPlan != null)
         {
             newTestRecord.TestPlanName      = getTestPlan.PlanName;
             newTestRecord.TestPlanId        = testPlanId;
             newTestRecord.TestPlanStartTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", getTestPlan.TestStartTime);
             newTestRecord.TestPlanEndTime   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", getTestPlan.TestEndTime);
             newTestRecord.TestManId         = testManId;
             newTestRecord.UserType          = userType;
             var getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.IdentityCard == identityCard);
             if (getUpdateTestRecord == null && userType != "2")
             {
                 getUpdateTestRecord = db.Test_TestRecord.FirstOrDefault(x => x.TestPlanId == testPlanId && x.TestManId == testManId);
             }
             if (getUpdateTestRecord != null)
             {
                 newTestRecord.TestRecordId = getUpdateTestRecord.TestRecordId;
                 newTestRecord.DepartId     = getUpdateTestRecord.DepartId;
                 newTestRecord.UnitId       = getUpdateTestRecord.UnitId;
                 newTestRecord.ProjectId    = getUpdateTestRecord.ProjectId;
                 newTestRecord.TestManName  = getUpdateTestRecord.TestManName;
                 newTestRecord.Telephone    = getUpdateTestRecord.Telephone;
                 newTestRecord.IdentityCard = getUpdateTestRecord.IdentityCard;
                 newTestRecord.TestScores   = getUpdateTestRecord.TestScores ?? 0;
             }
             else
             {
                 if (userType == "1")
                 {
                     var getUser = db.Sys_User.FirstOrDefault(x => x.UserId == testManId);
                     if (getUser != null)
                     {
                         newTestRecord.TestManName  = getUser.UserName;
                         newTestRecord.UnitId       = getUser.UnitId;
                         newTestRecord.DepartId     = getUser.DepartId;
                         newTestRecord.IdentityCard = getUser.IdentityCard;
                         newTestRecord.Telephone    = getUser.Telephone;
                     }
                 }
                 else if (userType == "3")
                 {
                     var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == testManId);
                     if (getPerson != null)
                     {
                         newTestRecord.TestManName  = getPerson.PersonName;
                         newTestRecord.ProjectId    = getPerson.ProjectId;
                         newTestRecord.UnitId       = getPerson.UnitId;
                         newTestRecord.WorkPostId   = getPerson.WorkPostId;
                         newTestRecord.IdentityCard = getPerson.IdentityCard;
                         newTestRecord.Telephone    = getPerson.Telephone;
                     }
                 }
                 else
                 {
                     newTestRecord.UnitId = newTestRecord.UnitId = CommonService.GetIsThisUnitId();
                 }
             }
             newTestRecord.DepartName  = DepartService.getDepartNameById(newTestRecord.DepartId);
             newTestRecord.UnitName    = UnitService.GetUnitNameByUnitId(newTestRecord.UnitId);
             newTestRecord.ProjectName = ProjectService.GetProjectNameByProjectId(newTestRecord.ProjectId);
             newTestRecord.IsThiUnit   = CommonService.GetIsThisUnit(newTestRecord.UnitId);
         }
         return(newTestRecord);
     }
 }
示例#3
0
 /// <summary>
 /// 创建菜单信息XML方法
 /// </summary>
 /// <param name="fileName"></param>
 public static void CreateMenuDataXML(string menuType, List <Model.SpSysMenuItem> menusList, string superMenu, XmlTextWriter writer)
 {
     try
     {
         if (superMenu == "0")
         {
             ///xml文件路径名
             string     fileName   = Funs.RootPath + "common\\" + menuType + ".xml";
             FileStream fileStream = new FileStream(fileName, FileMode.Create);
             writer = new XmlTextWriter(fileStream, Encoding.UTF8)
             {
                 //使用自动缩进便于阅读
                 Formatting = Formatting.Indented
             };
             writer.WriteStartDocument();
             writer.WriteStartElement("Tree");                                                            //创建父节点
             var menuItemList = menusList.Where(x => x.SuperMenu == superMenu).OrderBy(x => x.SortIndex); //获取菜单列表
             if (menuItemList.Count() > 0)
             {
                 foreach (var item in menuItemList)
                 {
                     writer.WriteStartElement("TreeNode");                                         //创建子节点
                     writer.WriteAttributeString("id", item.MenuId);                               //添加属性
                     string name = item.MenuName;
                     if (CommonService.GetIsThisUnit(Const.UnitId_CWCEC) && name.Contains("HSSE")) //五环
                     {
                         name = name.Replace("HSSE", "HSE");
                     }
                     else
                     {
                         if (!name.Contains("月总结"))
                         {
                             name = name.Replace("HSSE", "安全");
                         }
                     }
                     writer.WriteAttributeString("Text", name);
                     writer.WriteAttributeString("NavigateUrl", item.Url);
                     if (!string.IsNullOrEmpty(item.Icon))
                     {
                         writer.WriteAttributeString("Icon", item.Icon);
                     }
                     else
                     {
                         writer.WriteAttributeString("Icon", "LayoutContent");
                     }
                     if (!item.IsEnd.HasValue || item.IsEnd == false)
                     {
                         CreateMenuDataXML(menuType, menusList, item.MenuId, writer);
                     }
                     writer.WriteFullEndElement();    //子节点结束
                     //在节点间添加一些空格
                     writer.WriteWhitespace("\n");
                 }
             }
             writer.WriteFullEndElement();    //父节点结束
             writer.Close();
             fileStream.Close();
         }
         else
         {
             var subMenuItemList = menusList.Where(x => x.SuperMenu == superMenu).OrderBy(x => x.SortIndex);    //获取菜单集合
             if (subMenuItemList.Count() > 0)
             {
                 foreach (var item in subMenuItemList)
                 {
                     //使用自动缩进便于阅读
                     writer.Formatting = Formatting.Indented;
                     writer.WriteStartElement("TreeNode");           //创建子节点
                     writer.WriteAttributeString("id", item.MenuId); //添加属性
                     string name = item.MenuName;
                     if (CommonService.GetIsThisUnit(Const.UnitId_CWCEC) && name.Contains("HSSE"))
                     {
                         name = name.Replace("HSSE", "HSE");
                     }
                     else
                     {
                         if (!name.Contains("月总结"))
                         {
                             name = name.Replace("HSSE", "安全");
                         }
                     }
                     //if (BLL.SafetyDataService.GetSafetyDataByMenuId(item.MenuId) != null)
                     //{
                     //    writer.WriteAttributeString("Text", name + "*");
                     //}
                     //else
                     //{
                     writer.WriteAttributeString("Text", name);
                     //}
                     writer.WriteAttributeString("NavigateUrl", item.Url);
                     if (!string.IsNullOrEmpty(item.Icon))
                     {
                         writer.WriteAttributeString("Icon", item.Icon);
                     }
                     else
                     {
                         writer.WriteAttributeString("Icon", "LayoutContent");
                     }
                     if (!item.IsEnd.HasValue || item.IsEnd == false)
                     {
                         CreateMenuDataXML(menuType, menusList, item.MenuId, writer);
                     }
                     writer.WriteFullEndElement();    //子节点结束
                     //在节点间添加一些空格
                     writer.WriteWhitespace("\n");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ErrLogInfo.WriteLog(string.Empty, ex);
     }
 }
示例#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>
        /// 保存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);
            }
        }
示例#7
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);
        }
示例#8
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");
                }
            }
        }
示例#9
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);
                }
            }
        }
示例#10
0
        /// <summary>
        /// 根据考生计划结束时 将相关培训考生内容 写培训记录归档
        /// </summary>
        /// <param name="getTestPlan"></param>

        public static void InsertTrainRecord(Model.Training_TestPlan getTestPlan)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                ////获取培训计划
                var getTrainingPlan = db.Training_Plan.FirstOrDefault(e => e.PlanId == getTestPlan.PlanId);
                var getTrainRecord  = db.EduTrain_TrainRecord.FirstOrDefault(x => x.PlanId == getTestPlan.PlanId);
                if (getTrainingPlan != null && getTrainRecord == null)
                {
                    getTrainingPlan.States = "3";
                    db.SubmitChanges();

                    Model.EduTrain_TrainRecord newTrainRecord = new Model.EduTrain_TrainRecord
                    {
                        TrainingId     = SQLHelper.GetNewID(),
                        TrainingCode   = getTrainingPlan.PlanCode,
                        ProjectId      = getTrainingPlan.ProjectId,
                        TrainTitle     = getTrainingPlan.PlanName,
                        TrainContent   = getTrainingPlan.TrainContent,
                        TrainStartDate = getTrainingPlan.TrainStartDate,
                        TeachHour      = getTrainingPlan.TeachHour,
                        TrainEndDate   = getTrainingPlan.TrainEndDate,
                        TeachMan       = getTrainingPlan.TeachMan,
                        TeachAddress   = getTrainingPlan.TeachAddress,
                        Remark         = "来源:培训计划",
                        TrainTypeId    = getTrainingPlan.TrainTypeId,
                        TrainLevelId   = getTrainingPlan.TrainLevelId,
                        UnitIds        = getTrainingPlan.UnitIds,
                        States         = Const.State_2,
                        WorkPostIds    = getTrainingPlan.WorkPostId,
                        PlanId         = getTrainingPlan.PlanId,
                    };
                    newTrainRecord.CompileMan = UserService.GetUserNameByUserId(getTrainingPlan.DesignerId);
                    ///获取培训人员
                    var getTrainingTasks = from x in db.Training_Task where x.PlanId == getTrainingPlan.PlanId
                                           select x;
                    newTrainRecord.TrainPersonNum = getTrainingTasks.Count();
                    ///新增培训记录
                    db.EduTrain_TrainRecord.InsertOnSubmit(newTrainRecord);
                    db.SubmitChanges();

                    ////及格分数
                    int passScore = 80;
                    var testRule  = db.Sys_TestRule.FirstOrDefault();
                    if (testRule != null)
                    {
                        passScore = testRule.PassingScore;
                    }

                    foreach (var item in getTrainingTasks)
                    {
                        decimal gScores = 0;
                        bool    result  = false;
                        ////获取 考生试卷
                        var getTestRecord = db.Training_TestRecord.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.TestManId == item.UserId);
                        foreach (var itemR in getTestRecord)
                        {
                            if (itemR.TestScores > gScores)
                            {
                                gScores = itemR.TestScores ?? 0;
                            }
                        }

                        if (gScores >= passScore)
                        {
                            result = true;
                        }

                        Model.EduTrain_TrainRecordDetail newDetail = new Model.EduTrain_TrainRecordDetail
                        {
                            TrainDetailId = SQLHelper.GetNewID(),
                            TrainingId    = newTrainRecord.TrainingId,
                            PersonId      = item.UserId,
                            CheckScore    = gScores,
                            CheckResult   = result,
                        };
                        db.EduTrain_TrainRecordDetail.InsertOnSubmit(newDetail);
                        db.SubmitChanges();

                        ///// 培训考试 通过 更新卡号
                        if (result)
                        {
                            var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == newDetail.PersonId);
                            if (getPerson != null && string.IsNullOrEmpty(getPerson.CardNo))
                            {
                                getPerson.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getPerson.ProjectId, UnitService.GetUnitCodeByUnitId(getPerson.UnitId));
                                db.SubmitChanges();
                            }
                        }
                    }

                    ////增加一条编码记录
                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainRecordMenuId, newTrainRecord.ProjectId, null, newTrainRecord.TrainingId, newTrainRecord.TrainStartDate);
                    CommonService.btnSaveData(newTrainRecord.ProjectId, Const.ProjectTrainRecordMenuId, newTrainRecord.TrainingId, getTrainingPlan.DesignerId, true, newTrainRecord.TrainTitle, "../EduTrain/TrainRecordView.aspx?TrainingId={0}");
                }
            }
        }
示例#11
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);
            }
        }
示例#12
0
        /// <summary>
        /// 修改人员信息
        /// </summary>
        /// <param name="person">人员实体</param>
        public static void UpdatePerson(Model.SitePerson_Person person)
        {
            Model.SUBHSSEDB         db        = Funs.DB;
            Model.SitePerson_Person newPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == person.PersonId);
            if (newPerson != null)
            {
                newPerson.FromPersonId    = person.FromPersonId;
                newPerson.CardNo          = person.CardNo;
                newPerson.PersonName      = person.PersonName;
                newPerson.Sex             = person.Sex;
                newPerson.IdentityCard    = person.IdentityCard;
                newPerson.Address         = person.Address;
                newPerson.ProjectId       = person.ProjectId;
                newPerson.UnitId          = person.UnitId;
                newPerson.TeamGroupId     = person.TeamGroupId;
                newPerson.WorkAreaId      = person.WorkAreaId;
                newPerson.WorkPostId      = person.WorkPostId;
                newPerson.InTime          = person.InTime;
                newPerson.OutTime         = person.OutTime;
                newPerson.OutResult       = person.OutResult;
                newPerson.Telephone       = person.Telephone;
                newPerson.PositionId      = person.PositionId;
                newPerson.PostTitleId     = person.PostTitleId;
                newPerson.PhotoUrl        = person.PhotoUrl;
                newPerson.IsUsed          = person.IsUsed;
                newPerson.IsCardUsed      = person.IsCardUsed;
                newPerson.DepartId        = person.DepartId;
                newPerson.QRCodeAttachUrl = person.QRCodeAttachUrl;
                newPerson.Password        = GetPersonPassWord(person.IdentityCard);
                newPerson.ExchangeTime2   = null;
                if (!string.IsNullOrEmpty(person.AuditorId))
                {
                    newPerson.AuditorId = person.AuditorId;
                }
                if (person.AuditorDate.HasValue)
                {
                    newPerson.AuditorDate = person.AuditorDate;
                }

                newPerson.IsForeign = person.IsForeign;
                newPerson.IsOutside = person.IsOutside;
                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)
                    {
                        var inOutIn = BLL.PersonInOutService.GetPersonInOutByTimePersonId(person.PersonId, person.InTime.Value, true);
                        if (inOutIn == null)
                        {
                            newPersonInOut.ChangeTime = person.InTime;
                            newPersonInOut.IsIn       = true;
                            BLL.PersonInOutService.AddPersonInOut(newPersonInOut);
                        }
                    }

                    if (newPerson.OutTime.HasValue)
                    {
                        var inOutIn = BLL.PersonInOutService.GetPersonInOutByTimePersonId(person.PersonId, person.OutTime.Value, false);
                        if (inOutIn == null)
                        {
                            newPersonInOut.ChangeTime = person.OutTime;
                            newPersonInOut.IsIn       = false;
                            BLL.PersonInOutService.AddPersonInOut(newPersonInOut);
                        }
                    }
                }
            }
        }
示例#13
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);
        }
示例#14
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();
                        }
                    }
                }
            }
        }