コード例 #1
0
        /// <summary>
        /// 数据和附件插入到多附件表
        /// </summary>
        public static void InsertAttachFile(string attachFileId, string dataId, string attachSource, string attachUrl, List <byte[]> fileContext)
        {
            //多附件
            var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);

            if (attachFile == null && !string.IsNullOrEmpty(attachSource))
            {
                Model.AttachFile newAttachFile = new Model.AttachFile
                {
                    AttachFileId = attachFileId,
                    ToKeyId      = dataId,
                    AttachSource = attachSource,
                    AttachUrl    = attachUrl
                };
                Funs.DB.AttachFile.InsertOnSubmit(newAttachFile);
                Funs.DB.SubmitChanges();

                ////插入附件文件
                BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
            }
            else
            {
                if (attachFile.AttachUrl != attachUrl)
                {
                    ///删除附件文件
                    BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
                    ////插入附件文件
                    BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
                    attachFile.AttachSource = attachSource;
                    attachFile.AttachUrl    = attachUrl;
                    Funs.DB.SubmitChanges();
                }
            }
        }
コード例 #2
0
ファイル: UploadFileService.cs プロジェクト: klniu/SUBHSSE
        /// <summary>
        /// 保存附件
        /// </summary>
        /// <param name="source"></param>
        /// <param name="attachUrl"></param>
        /// <param name="menuId"></param>
        /// <param name="toKeyId"></param>
        public static void SaveAttachUrl(string source, string attachUrl, string menuId, string toKeyId)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                List <Model.AttachFile> sour = (from x in db.AttachFile where x.MenuId == menuId &&
                                                x.ToKeyId == toKeyId select x).ToList();
                if (sour.Count() == 0)
                {
                    Model.AttachFile att = new Model.AttachFile
                    {
                        AttachFileId = SQLHelper.GetNewID(),
                        ToKeyId      = toKeyId,
                        AttachSource = source.ToString(),
                        AttachUrl    = attachUrl,
                        MenuId       = menuId,
                        //AttachPath= attachPath,
                    };
                    db.AttachFile.InsertOnSubmit(att);
                    db.SubmitChanges();
                }
                else
                {
                    Model.AttachFile att = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
                    if (att != null)
                    {
                        att.ToKeyId      = toKeyId;
                        att.AttachSource = source.ToString();
                        att.AttachUrl    = attachUrl;
                        att.MenuId       = menuId;
                        db.SubmitChanges();
                    }
                }
                //if (!string.IsNullOrEmpty(toKeyId))
                //{
                //    List<string> getattachUrlItems = Funs.GetStrListByStr(attachUrl, ',');
                //    foreach (var item in getattachUrlItems)
                //    {
                //        Model.AttachFileItem newItem = new Model.AttachFileItem
                //        {
                //            AttachFileItemId = SQLHelper.GetNewID(),
                //            ToKeyId = toKeyId,
                //            AttachUrl = item,
                //        };

                //        db.AttachFileItem.InsertOnSubmit(newItem);
                //        db.SubmitChanges();
                //    }
                //}
                //else
                //{
                //    var getItems = from x in db.AttachFileItem where x.ToKeyId == toKeyId select x;
                //    if (getItems.Count() > 0)
                //    {
                //        db.AttachFileItem.DeleteAllOnSubmit(getItems);
                //        db.SubmitChanges();
                //    }
                //}
            }
        }
コード例 #3
0
 /// <summary>
 /// 修改附件存储信息
 /// </summary>
 /// <param name="workArea"></param>
 public static void updateAttachFile(Model.AttachFile attachFile)
 {
     Model.AttachFile newAttachFile = db.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFile.AttachFileId);
     newAttachFile.ToKeyId      = attachFile.ToKeyId;
     newAttachFile.AttachSource = attachFile.AttachSource;
     newAttachFile.AttachUrl    = attachFile.AttachUrl;
     newAttachFile.MenuId       = attachFile.MenuId;
     db.SubmitChanges();
 }
コード例 #4
0
 /// <summary>
 /// 根据对应Id删除附件信息及文件存放的物理位置
 /// </summary>
 /// <param name="workAreaId"></param>
 public static void DeleteAttachFile(string rootPath, string toKeyId, string menuId)
 {
     Model.AttachFile att = db.AttachFile.FirstOrDefault(e => e.ToKeyId == toKeyId && e.MenuId == menuId);
     if (att != null)
     {
         BLL.UploadFileService.DeleteFile(rootPath, att.AttachUrl);
         db.AttachFile.DeleteOnSubmit(att);
         db.SubmitChanges();
     }
 }
コード例 #5
0
        /// <summary>
        /// 添加附件存储信息
        /// </summary>
        /// <param name="workArea"></param>
        public static void AddAttachFile(Model.AttachFile attachFile)
        {
            string newKeyID = SQLHelper.GetNewID(typeof(Model.AttachFile));

            Model.AttachFile newAttachFile = new Model.AttachFile();
            newAttachFile.AttachFileId = newKeyID;
            newAttachFile.ToKeyId      = attachFile.ToKeyId;
            newAttachFile.AttachSource = attachFile.AttachSource;
            newAttachFile.AttachUrl    = attachFile.AttachUrl;
            newAttachFile.MenuId       = attachFile.MenuId;

            db.AttachFile.InsertOnSubmit(newAttachFile);
            db.SubmitChanges();
        }
コード例 #6
0
ファイル: CommonService.cs プロジェクト: klniu/SUBHSSE
        /// <summary>
        ///根据主键删除附件
        /// </summary>
        /// <param name="lawRegulationId"></param>
        public static void DeleteAttachFileById(string menuId, string id)
        {
            Model.SUBHSSEDB  db         = Funs.DB;
            Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.MenuId == menuId && e.ToKeyId == id);
            if (attachFile != null)
            {
                if (!string.IsNullOrEmpty(attachFile.AttachUrl))
                {
                    BLL.UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
                }

                db.AttachFile.DeleteOnSubmit(attachFile);
                db.SubmitChanges();
            }
        }
コード例 #7
0
ファイル: CommonService.cs プロジェクト: klniu/SUBHSSE
        /// <summary>
        ///根据主键删除附件
        /// </summary>
        /// <param name="lawRegulationId"></param>
        public static void DeleteAttachFileById(string id)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.ToKeyId == id);
                if (attachFile != null)
                {
                    if (!string.IsNullOrEmpty(attachFile.AttachUrl))
                    {
                        UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
                    }

                    db.AttachFile.DeleteOnSubmit(attachFile);
                    db.SubmitChanges();
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 修改危险观察登记信息
        /// </summary>
        /// <param name="hazardRegister">危险观察登记实体</param>
        public static void UpdateHazardRegister(Model.HSSE_Hazard_HazardRegister hazardRegister)
        {
            Model.SUBHSSEDB db = Funs.DB;
            Model.HSSE_Hazard_HazardRegister newHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(e => e.HazardRegisterId == hazardRegister.HazardRegisterId);
            if (newHazardRegister != null)
            {
                newHazardRegister.HazardCode      = hazardRegister.HazardCode;
                newHazardRegister.RegisterDef     = hazardRegister.RegisterDef;
                newHazardRegister.Rectification   = hazardRegister.Rectification;
                newHazardRegister.Place           = hazardRegister.Place;
                newHazardRegister.ResponsibleUnit = hazardRegister.ResponsibleUnit;
                newHazardRegister.Observer        = hazardRegister.Observer;
                newHazardRegister.RectifiedDate   = hazardRegister.RectifiedDate;
                newHazardRegister.AttachUrl       = hazardRegister.AttachUrl;
                newHazardRegister.ProjectId       = hazardRegister.ProjectId;
                newHazardRegister.States          = hazardRegister.States;
                newHazardRegister.IsEffective     = hazardRegister.IsEffective;
                newHazardRegister.ResponsibleMan  = hazardRegister.ResponsibleMan;
                newHazardRegister.CheckManId      = hazardRegister.CheckManId;
                //newHazardRegister.CheckTime = hazardRegister.CheckTime;
                newHazardRegister.RectificationPeriod   = hazardRegister.RectificationPeriod;
                newHazardRegister.ImageUrl              = hazardRegister.ImageUrl;
                newHazardRegister.RectificationImageUrl = hazardRegister.RectificationImageUrl;
                newHazardRegister.RectificationTime     = hazardRegister.RectificationTime;
                newHazardRegister.ConfirmMan            = hazardRegister.ConfirmMan;
                newHazardRegister.ConfirmDate           = hazardRegister.ConfirmDate;
                newHazardRegister.HandleIdea            = hazardRegister.HandleIdea;
                newHazardRegister.CutPayment            = hazardRegister.CutPayment;
                newHazardRegister.ProblemTypes          = hazardRegister.ProblemTypes;
                newHazardRegister.DIC_ID = hazardRegister.DIC_ID;
                //把附件表的路径复制过来
                Model.AttachFile file = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId, Const.HSSE_HiddenRectificationListMenuId);
                if (file != null)
                {
                    newHazardRegister.ImageUrl = file.AttachUrl;
                }
                Model.AttachFile fileR = BLL.AttachFileService.GetAttachFile(hazardRegister.HazardRegisterId + "-R", Const.HSSE_HiddenRectificationListMenuId);
                if (fileR != null)
                {
                    newHazardRegister.RectificationImageUrl = fileR.AttachUrl;
                }

                db.SubmitChanges();
            }
        }
コード例 #9
0
        /// <summary>
        /// 得到Session
        /// </summary>
        /// <returns></returns>
        private JArray GetSourceData()
        {
            if (Session[sessionName] == null && !string.IsNullOrEmpty(ToKeyId))
            {
                Session[sessionName] = new JArray();
                Model.AttachFile sour = new Model.AttachFile();
                if (this.MenuId == Const.ProjectPunishNoticeMenuId || this.MenuId == Const.ProjectPunishNoticeStatisticsMenuId)
                {
                    sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == ToKeyId && x.MenuId == this.MenuId);
                }
                else
                {
                    sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == ToKeyId);
                }

                if (sour != null)
                {
                    string        url  = sour.AttachUrl.Replace('\\', '/');
                    List <string> list = Funs.GetStrListByStr(url, ',');
                    if (list.Count() > 0)
                    {
                        int i = 0;
                        foreach (var item in list)
                        {
                            string atturl = Funs.RootPath + item.Replace(';', ' ').Trim();
                            if (File.Exists(atturl))
                            {
                                i += 1;
                                break;
                            }
                        }
                        if (i > 0)
                        {
                            Session[sessionName] = JArray.Parse(sour.AttachSource);
                        }
                    }
                }
            }

            return((JArray)Session[sessionName]);
        }
コード例 #10
0
 /// <summary>
 /// 加载页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.CheckSpecialId = Request.Params["CheckSpecialId"];
         var checkSpecial = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(this.CheckSpecialId);
         if (checkSpecial != null)
         {
             this.txtCheckTime.Text = "检查时间:";
             if (checkSpecial.CheckTime != null)
             {
                 this.txtCheckTime.Text += string.Format("{0:yyyy-MM-dd}", checkSpecial.CheckTime);
             }
             string         personStr = "检查人:";
             Model.Sys_User user      = BLL.UserService.GetUserByUserId(checkSpecial.CheckPerson);
             if (user != null)
             {
                 personStr += user.UserName + "、";
             }
             if (!string.IsNullOrEmpty(checkSpecial.PartInPersonIds))
             {
                 string[] strs = checkSpecial.PartInPersonIds.Split(',');
                 foreach (var s in strs)
                 {
                     Model.Sys_User checkPerson = BLL.UserService.GetUserByUserId(s);
                     if (checkPerson != null)
                     {
                         personStr += checkPerson.UserName + "、";
                     }
                 }
             }
             if (!string.IsNullOrEmpty(personStr))
             {
                 personStr = personStr.Substring(0, personStr.LastIndexOf("、"));
             }
             if (!string.IsNullOrEmpty(checkSpecial.PartInPersonNames))
             {
                 if (personStr != "检查人:")
                 {
                     personStr += "、" + checkSpecial.PartInPersonNames;
                 }
                 else
                 {
                     personStr += checkSpecial.PartInPersonNames;
                 }
             }
             this.txtCheckPerson.Text = personStr;
             this.txtCheckType.Text   = "检查项目:";
             if (checkSpecial.CheckType == "0")
             {
                 this.txtCheckType.Text += "周检";
             }
             else if (checkSpecial.CheckType == "1")
             {
                 this.txtCheckType.Text += "月检";
             }
             else if (checkSpecial.CheckType == "2")
             {
                 this.txtCheckType.Text += "其它";
             }
             var    checkSpecialDetails = BLL.Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialId(this.CheckSpecialId);
             int    i   = 1;
             string str = "<table id='Table3' runat='server' width='100%' cellpadding='0' cellspacing='0' border='0' frame='vsides' bordercolor='#000000'>"
                          + "<tr><td align='center' style='width:5%; border: 1px solid #000000; font-size:15px; border-right: none;'>序号</td>"
                          + "<td align='center' style='width:30%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患照片或描述</td>"
                          + "<td align='center' style='width:20%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改措施</td>"
                          + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改责任人</td>"
                          + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改时间</td>"
                          + "<td align='center' style='width:10%; border: 1px solid #000000; font-size:15px; border-right: none;'>责任单位</td>"
                          + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; border-right: none;'>复检人</td>"
                          + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; border-right: none;'>复检时间</td>"
                          + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; '>复检结果</td></tr>";
             foreach (var checkSpecialDetail in checkSpecialDetails)
             {
                 string           photo1     = string.Empty;
                 string           photo2     = string.Empty;
                 Model.AttachFile attachFile = BLL.AttachFileService.GetAttachFile(checkSpecialDetail.CheckSpecialDetailId, BLL.Const.ProjectCheckSpecialMenuId);
                 if (attachFile != null)
                 {
                     List <string> urls  = new List <string>();
                     string[]      lists = attachFile.AttachUrl.Split(',');
                     foreach (var list in lists)
                     {
                         if (!string.IsNullOrEmpty(list))
                         {
                             urls.Add(list);
                         }
                     }
                     if (urls.Count > 1)   //两个附件
                     {
                         photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />";
                         photo2 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[1] + "' />";
                     }
                     else
                     {
                         photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />";
                     }
                 }
                 string          unitName      = string.Empty;
                 string          completedDate = string.Empty;
                 Model.Base_Unit unit          = BLL.UnitService.GetUnitByUnitId(checkSpecialDetail.UnitId);
                 if (unit != null)
                 {
                     unitName = unit.UnitName;
                 }
                 if (checkSpecialDetail.CompletedDate != null)
                 {
                     completedDate = string.Format("{0:yyyy-MM-dd}", checkSpecialDetail.CompletedDate);
                 }
                 str += "<tr><td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;'>" + i + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkSpecialDetail.Unqualified + "<br/>" + photo1 + "<br/>" + photo2 + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + completedDate + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + unitName + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none;' ></td></tr>";
                 i++;
             }
             str += "</table>";
             this.div3.InnerHtml = str;
         }
     }
 }
コード例 #11
0
        /// <summary>
        /// 扫描文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnImageMagnify_Click(object sender, EventArgs e)
        {
            try
            {
                DeviceManager manager = new DeviceManagerClass();
                Device        device  = null;
                foreach (DeviceInfo info in manager.DeviceInfos)
                {
                    if (info.Type != WiaDeviceType.ScannerDeviceType)
                    {
                        continue;
                    }
                    device = info.Connect();
                    break;
                }
                Item item                   = device.Items[1];
                CommonDialogClass cdc       = new WIA.CommonDialogClass();
                ImageFile         imageFile = null;
                imageFile = cdc.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType,
                                                 WIA.WiaImageIntent.TextIntent,
                                                 WIA.WiaImageBias.MaximizeQuality,
                                                 "{00000000-0000-0000-0000-000000000000}",
                                                 true,
                                                 true,
                                                 false);
                if (imageFile != null)
                {
                    var buffer = imageFile.FileData.get_BinaryData() as byte[];
                    using (MemoryStream ms = new MemoryStream())
                    {
                        ms.Write(buffer, 0, buffer.Length);
                        string filePath = Server.MapPath("~/") + AttachPath;  ///文件夹
                        if (!Directory.Exists(filePath))
                        {
                            Directory.CreateDirectory(filePath);
                        }
                        string name = "\\";
                        var    menu = BLL.SysMenuService.GetSysMenuByMenuId(this.MenuId);
                        if (menu != null)
                        {
                            name += menu.MenuName;
                        }
                        name += Funs.GetNewFileName() + ".jpg";
                        string url = filePath + name;
                        if (!string.IsNullOrEmpty(url))
                        {
                            using (FileStream fs = new FileStream(url, FileMode.Create, FileAccess.Write))
                            {
                                ms.WriteTo(fs);
                                string attachUrl = AttachPath + name;
                                if (!string.IsNullOrEmpty(attachUrl))
                                {
                                    attachUrl = attachUrl.Replace('/', '\\');
                                }
                                string           oldSrouce = string.Empty;
                                string           FullPath  = string.Empty;
                                Model.AttachFile att       = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.ToKeyId);
                                if (att != null && !string.IsNullOrEmpty(att.AttachUrl))
                                {
                                    FullPath  = att.AttachUrl + "," + attachUrl;
                                    oldSrouce = att.AttachSource;
                                }
                                else
                                {
                                    FullPath = attachUrl;
                                }
                                string source = BLL.UploadFileService.GetSourceByAttachUrl(attachUrl, buffer.Length, oldSrouce);
                                //this.SaveData(source, FullPath); ///保存方法
                                Session[sessionName] = JArray.Parse(source);
                            }

                            this.BindGrid();
                            ShowNotify("扫描完成!", MessageBoxIcon.Success);
                        }
                    }
                }
            }
            catch
            {
                ShowNotify("请检查扫描仪是否连接正确!", MessageBoxIcon.Warning);
            }
        }
コード例 #12
0
 /// <summary>
 /// 加载页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.CheckColligationId = Request.Params["CheckColligationId"];
         var checkColligation = BLL.Check_CheckColligationService.GetCheckColligationByCheckColligationId(this.CheckColligationId);
         if (checkColligation != null)
         {
             this.txtCheckTime.Text = "检查时间:";
             if (checkColligation.CheckTime != null)
             {
                 this.txtCheckTime.Text += string.Format("{0:yyyy-MM-dd}", checkColligation.CheckTime);
             }
             string         personStr = "检查人:";
             Model.Sys_User user      = BLL.UserService.GetUserByUserId(checkColligation.CheckPerson);
             if (user != null)
             {
                 personStr += user.UserName + "、";
             }
             if (!string.IsNullOrEmpty(checkColligation.PartInPersonIds))
             {
                 string[] strs = checkColligation.PartInPersonIds.Split(',');
                 foreach (var s in strs)
                 {
                     Model.Sys_User checkPerson = BLL.UserService.GetUserByUserId(s);
                     if (checkPerson != null)
                     {
                         personStr += checkPerson.UserName + "、";
                     }
                 }
             }
             if (!string.IsNullOrEmpty(personStr))
             {
                 personStr = personStr.Substring(0, personStr.LastIndexOf("、"));
             }
             if (!string.IsNullOrEmpty(checkColligation.PartInPersonNames))
             {
                 if (personStr != "检查人:")
                 {
                     personStr += "、" + checkColligation.PartInPersonNames;
                 }
                 else
                 {
                     personStr += checkColligation.PartInPersonNames;
                 }
             }
             this.txtCheckPerson.Text = personStr;
             this.txtCheckType.Text   = "检查项目:";
             if (checkColligation.CheckType == "0")
             {
                 this.txtCheckType.Text += "周检";
             }
             else if (checkColligation.CheckType == "1")
             {
                 this.txtCheckType.Text += "月检";
             }
             else if (checkColligation.CheckType == "2")
             {
                 this.txtCheckType.Text += "其它";
             }
             var    checkColligationDetails = BLL.Check_CheckColligationDetailService.GetCheckColligationDetailByCheckColligationId(this.CheckColligationId);
             int    i   = 1;
             string str = "<table id='Table3' runat='server' width='100%' cellpadding='0' cellspacing='0' border='0' frame='vsides' bordercolor='#000000'>"
                          + "<tr><td align='center' style='width:5%; border: 1px solid #000000; font-size:15px; border-right: none;'>序号</td>"
                          + "<td align='center' style='width:15%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患内容</td>"
                          + "<td align='center' style='width:10%; border: 1px solid #000000; font-size:15px; border-right: none;'>检查区域</td>"
                          + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患类型</td>"
                          + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患级别</td>"
                          + "<td align='center' style='width:12%; border: 1px solid #000000; font-size:15px; border-right: none;'>责任单位</td>"
                          + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>责任人</td>"
                          + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改限时</td>"
                          + "<td align='center' style='width:12%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改要求</td>"
                          + "<td align='center' style='width:14%; border: 1px solid #000000; font-size:15px; '>处理措施</td></tr>";
             foreach (var checkColligationDetail in checkColligationDetails)
             {
                 string           photo1     = string.Empty;
                 string           photo2     = string.Empty;
                 Model.AttachFile attachFile = BLL.AttachFileService.GetAttachFile(checkColligationDetail.CheckColligationDetailId, BLL.Const.ProjectCheckColligationWHMenuId);
                 if (attachFile != null)
                 {
                     List <string> urls  = new List <string>();
                     string[]      lists = attachFile.AttachUrl.Split(',');
                     foreach (var list in lists)
                     {
                         if (!string.IsNullOrEmpty(list))
                         {
                             urls.Add(list);
                         }
                     }
                     if (urls.Count > 1)   //两个附件
                     {
                         photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />";
                         photo2 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[1] + "' />";
                     }
                     else
                     {
                         photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />";
                     }
                 }
                 string          unitName       = string.Empty;
                 string          personName     = string.Empty;
                 string          handleStepName = string.Empty;
                 Model.Base_Unit unit           = BLL.UnitService.GetUnitByUnitId(checkColligationDetail.UnitId);
                 if (unit != null)
                 {
                     unitName = unit.UnitName;
                 }
                 if (!string.IsNullOrEmpty(checkColligationDetail.PersonId))
                 {
                     var person = BLL.PersonService.GetPersonById(checkColligationDetail.PersonId);
                     if (person != null)
                     {
                         personName = person.PersonName;
                     }
                 }
                 if (!string.IsNullOrEmpty(checkColligationDetail.HandleStep))
                 {
                     List <string> lists = checkColligationDetail.HandleStep.Split('|').ToList();
                     if (lists.Count > 0)
                     {
                         foreach (var item in lists)
                         {
                             Model.Sys_Const con = BLL.ConstValue.GetConstByConstValueAndGroupId(item, BLL.ConstValue.Group_HandleStep);
                             if (con != null)
                             {
                                 handleStepName += con.ConstText + "|";
                             }
                         }
                     }
                     if (!string.IsNullOrEmpty(handleStepName))
                     {
                         handleStepName = handleStepName.Substring(0, handleStepName.LastIndexOf("|"));
                     }
                 }
                 str += "<tr><td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;'>" + i + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.Unqualified + "<br/>" + photo1 + "<br/>" + photo2 + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.WorkArea + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.HiddenDangerType + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.HiddenDangerLevel + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + unitName + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + personName + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + string.Format("{0:yyyy-MM-dd}", checkColligationDetail.LimitedDate) + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.Suggestions + "</td>"
                        + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none;' >" + handleStepName + "</td></tr>";
                 i++;
             }
             str += "</table>";
             this.div3.InnerHtml = str;
         }
     }
 }
コード例 #13
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ItemSelectedList.Count() > 0)
     {
         foreach (var item in ItemSelectedList)
         {
             Model.Law_ManageRule rule = BLL.ManageRuleService.GetManageRuleById(item);
             if (rule != null)
             {
                 string newKeyID = SQLHelper.GetNewID(typeof(Model.ActionPlan_ManagerRule));
                 Model.ActionPlan_ManagerRule newManagerRule = new Model.ActionPlan_ManagerRule
                 {
                     ManagerRuleId    = newKeyID,
                     OldManageRuleId  = rule.ManageRuleId,
                     ProjectId        = this.CurrUser.LoginProjectId,
                     ManageRuleName   = rule.ManageRuleName,
                     ManageRuleTypeId = rule.ManageRuleTypeId,
                     CompileDate      = DateTime.Now,
                     Remark           = rule.Remark,
                     CompileMan       = this.CurrUser.UserId,
                     IsIssue          = false,
                     Flag             = true,
                     State            = BLL.Const.State_0,
                     AttachUrl        = rule.AttachUrl,
                     SeeFile          = rule.SeeFile
                 };
                 BLL.ActionPlan_ManagerRuleService.AddManageRule(newManagerRule);
                 ////保存流程审核数据
                 this.ctlAuditFlow.btnSaveData(this.CurrUser.LoginProjectId, BLL.Const.ActionPlan_ManagerRuleMenuId, newManagerRule.ManagerRuleId, true, newManagerRule.ManageRuleName, "../ActionPlan/ManagerRuleView.aspx?ManagerRuleId={0}");
                 Model.SUBHSSEDB  db         = Funs.DB;
                 Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(x => x.ToKeyId == item);
                 if (attachFile != null)
                 {
                     Model.AttachFile newAttachFile = new Model.AttachFile
                     {
                         AttachFileId = SQLHelper.GetNewID(typeof(Model.AttachFile)),
                         ToKeyId      = newKeyID
                     };
                     string[] urls = attachFile.AttachUrl.Split(',');
                     foreach (string url in urls)
                     {
                         string urlStr = BLL.Funs.RootPath + url;
                         if (File.Exists(urlStr))
                         {
                             string newUrl = urlStr.Replace("ManageRule", "ActionPlanManagerRule");
                             if (!Directory.Exists(newUrl.Substring(0, newUrl.LastIndexOf("\\"))))
                             {
                                 Directory.CreateDirectory(newUrl.Substring(0, newUrl.LastIndexOf("\\")));
                             }
                             if (!File.Exists(newUrl))
                             {
                                 File.Copy(urlStr, newUrl);
                             }
                         }
                     }
                     newAttachFile.AttachSource = attachFile.AttachSource.Replace("ManageRule", "ActionPlanManagerRule");
                     newAttachFile.AttachUrl    = attachFile.AttachUrl.Replace("ManageRule", "ActionPlanManagerRule");
                     newAttachFile.MenuId       = BLL.Const.ActionPlan_ManagerRuleMenuId;
                     db.AttachFile.InsertOnSubmit(newAttachFile);
                     db.SubmitChanges();
                 }
             }
         }
         PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
     }
     else
     {
         Alert.ShowInParent("请至少选择一条记录!");
         return;
     }
 }
コード例 #14
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var thisUnit = BLL.CommonService.GetIsThisUnit();
                if (thisUnit != null)
                {
                    this.Label8.Text  = thisUnit.UnitName + this.Label8.Text;
                    this.Label18.Text = thisUnit.UnitName + this.Label18.Text;
                    this.Label19.Text = thisUnit.UnitName + this.Label19.Text;
                }

                this.RectifyNoticeId = Request.Params["RectifyNoticeId"];
                var rectifyNotice = BLL.RectifyNoticesService.GetRectifyNoticesById(this.RectifyNoticeId);
                if (rectifyNotice != null)
                {
                    this.txtRectifyNoticeCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.RectifyNoticeId);
                    Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(rectifyNotice.UnitId);
                    if (unit != null)
                    {
                        this.txtUnitName.Text        = unit.UnitName;
                        this.txtUnitNameProject.Text = unit.UnitName + "项目部:";
                    }
                    this.txtDutyPerson1.Text = rectifyNotice.DutyPerson;
                    if (rectifyNotice.CheckedDate != null)
                    {
                        this.txtCheckedDate.Text  = string.Format("{0:yyyy-MM-dd}", rectifyNotice.CheckedDate);
                        this.txtCheckedDate2.Text = rectifyNotice.CheckedDate.Value.Year + "年" + rectifyNotice.CheckedDate.Value.Month + "月" + rectifyNotice.CheckedDate.Value.Day + "日";
                    }
                    if (!string.IsNullOrEmpty(rectifyNotice.WrongContent))
                    {
                        this.txtWrongContent.Text = rectifyNotice.WrongContent;
                    }
                    Model.Sys_User user = BLL.UserService.GetUserByUserId(rectifyNotice.SignPerson);
                    if (user != null)
                    {
                        this.txtSignPerson.Text = user.UserName;
                    }
                    if (rectifyNotice.SignDate != null)
                    {
                        this.txtSignDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.SignDate);
                    }
                    if (!string.IsNullOrEmpty(rectifyNotice.CompleteStatus))
                    {
                        this.txtCompleteStatus.Text = rectifyNotice.CompleteStatus;
                    }
                    this.txtDutyPerson2.Text = rectifyNotice.DutyPerson;
                    if (rectifyNotice.CompleteDate != null)
                    {
                        this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.CompleteDate);
                    }
                    Model.AttachFile attachFile = BLL.AttachFileService.GetAttachFile(this.RectifyNoticeId, BLL.Const.ProjectRectifyNoticeMenuId);
                    if (attachFile != null)
                    {
                        List <string> urls  = new List <string>();
                        string[]      lists = attachFile.AttachUrl.Split(',');
                        foreach (var list in lists)
                        {
                            if (!string.IsNullOrEmpty(list))
                            {
                                urls.Add(list);
                            }
                        }
                        string str = string.Empty;
                        str = "<table id='Table3' runat='server' width='100%' cellpadding='0' cellspacing='0' border='0' bordercolor='#000000'>";
                        if (urls.Count > 1)   //两个附件
                        {
                            string photo1 = "<img alt='' runat='server' id='img111' width='280' height='280' src='" + "../" + urls[0] + "' />";
                            string photo2 = "<img alt='' runat='server' id='img111' width='280' height='280' src='" + "../" + urls[1] + "' />";
                            str += "<tr><td align='center' colspan='2'>" + photo1 + "</td>";
                            str += "<td align='center' colspan='2'>" + photo2 + "</td></tr>";
                        }
                        else if (urls.Count == 1)
                        {
                            string photo1 = "<img alt='' runat='server' id='img111' width='250' height='250' src='" + "../" + urls[0] + "' />";
                            str += "<td align='center' colspan='4'>" + photo1 + "</td></tr>";
                        }
                        str += "</table>";
                        this.div3.InnerHtml = str;
                    }
                }
            }
        }