Exemplo n.º 1
0
 /// <summary>
 /// 根据主键删除应急物资管理
 /// </summary>
 /// <param name="FileId"></param>
 public static void DeleteEmergencySupplyById(string FileId)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Emergency_EmergencySupply EmergencySupply = db.Emergency_EmergencySupply.FirstOrDefault(e => e.FileId == FileId);
     if (EmergencySupply != null)
     {
         ///删除编码表记录
         BLL.CodeRecordsService.DeleteCodeRecordsByDataId(EmergencySupply.FileId);
         ////删除附件表
         BLL.CommonService.DeleteAttachFileById(EmergencySupply.FileId);
         ////删除流程表
         BLL.CommonService.DeleteFlowOperateByID(EmergencySupply.FileId);
         db.Emergency_EmergencySupply.DeleteOnSubmit(EmergencySupply);
         db.SubmitChanges();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 修改应急物资管理
 /// </summary>
 /// <param name="EmergencySupply"></param>
 public static void UpdateEmergencySupply(Model.Emergency_EmergencySupply EmergencySupply)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Emergency_EmergencySupply newEmergencySupply = db.Emergency_EmergencySupply.FirstOrDefault(e => e.FileId == EmergencySupply.FileId);
     if (newEmergencySupply != null)
     {
         newEmergencySupply.FileCode    = EmergencySupply.FileCode;
         newEmergencySupply.FileName    = EmergencySupply.FileName;
         newEmergencySupply.UnitId      = EmergencySupply.UnitId;
         newEmergencySupply.FileContent = EmergencySupply.FileContent;
         newEmergencySupply.CompileMan  = EmergencySupply.CompileMan;
         newEmergencySupply.CompileDate = EmergencySupply.CompileDate;
         newEmergencySupply.AttachUrl   = EmergencySupply.AttachUrl;
         newEmergencySupply.States      = EmergencySupply.States;
         db.SubmitChanges();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 添加应急物资管理
 /// </summary>
 /// <param name="EmergencySupply"></param>
 public static void AddEmergencySupply(Model.Emergency_EmergencySupply EmergencySupply)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Emergency_EmergencySupply newEmergencySupply = new Model.Emergency_EmergencySupply
     {
         FileId      = EmergencySupply.FileId,
         ProjectId   = EmergencySupply.ProjectId,
         FileCode    = EmergencySupply.FileCode,
         FileName    = EmergencySupply.FileName,
         UnitId      = EmergencySupply.UnitId,
         FileContent = EmergencySupply.FileContent,
         CompileMan  = EmergencySupply.CompileMan,
         CompileDate = EmergencySupply.CompileDate,
         AttachUrl   = EmergencySupply.AttachUrl,
         States      = EmergencySupply.States
     };
     db.Emergency_EmergencySupply.InsertOnSubmit(newEmergencySupply);
     db.SubmitChanges();
     ////增加一条编码记录
     BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectEmergencySupplyMenuId, EmergencySupply.ProjectId, null, EmergencySupply.FileId, EmergencySupply.CompileDate);
 }
Exemplo n.º 4
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");
                }
            }
        }