/// <summary>
        /// 证书附件上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int singleProjectID = DNTRequest.GetQueryInt("SingleProjectID", 0);

            if (singleProjectID > 0)
            {
                HttpFileCollection uploadFiles  = HttpContext.Current.Request.Files;//获取所有客户端上传文件对象
                HttpPostedFile     userPostFile = null;

                if (uploadFiles.Count > 0)
                {
                    for (int i = 0; i < uploadFiles.Count; i++)
                    {
                        userPostFile = uploadFiles[i];//获取独立的文件对象
                        string fileName = Common.Common.SaveFile(Server.MapPath(savePath), userPostFile, "R");

                        if (fileName != "")
                        {
                            T_FileAttach_MDL mdl = new T_FileAttach_MDL();
                            mdl.AttachName  = fileName;
                            mdl.AttachPath  = savePath + fileName;
                            mdl.CreateDate  = DateTime.Now;
                            mdl.PriKeyValue = singleProjectID;
                            mdl.OrderIndex  = 0;
                            mdl.Flag        = "Company_Registration";

                            if (Hid_ghxkz.Value != "")
                            {
                                Hid_ghxkz.Value = "";
                                mdl.AttachCode  = SystemSet.EumProject_Credentials.ghxkz.ToString();
                                fileAttachBLL.DelFileAttach(singleProjectID.ToString(), mdl.AttachCode, mdl.Flag);
                            }
                            else if (Hid_sgxkz.Value != "")
                            {
                                Hid_sgxkz.Value = "";
                                mdl.AttachCode  = SystemSet.EumProject_Credentials.sgxkz.ToString();
                                fileAttachBLL.DelFileAttach(singleProjectID.ToString(), mdl.AttachCode, mdl.Flag);
                            }
                            else if (Hid_other.Value != "")
                            {
                                mdl.AttachCode = SystemSet.EumProject_Credentials.other.ToString();
                            }

                            int attachID = fileAttachBLL.Add(mdl);
                            PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_FileAttach;key=", attachID,
                                                                                                        ";SingleProjectID=", singleProjectID, ";AttachCode=", mdl.AttachCode, ";上传工程证书附件"));
                        }
                    }
                }
                Common.MessageBox.CloseLayerOpenWeb(this.Page);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 证书附件上传
        /// </summary>
        /// <param name="tSingleProjectID"></param>
        protected void UploadFile(int tSingleProjectID)
        {
            HttpFileCollection uploadFiles  = HttpContext.Current.Request.Files;//获取所有客户端上传文件对象
            HttpPostedFile     userPostFile = null;

            if (uploadFiles.Count > 0)
            {
                for (int i = 0; i < uploadFiles.Count; i++)
                {
                    userPostFile = uploadFiles[i];//获取独立的文件对象
                    string fileName = Common.Common.SaveFile(Server.MapPath(savePath), userPostFile, "R");

                    if (fileName != "")
                    {
                        T_FileAttach_BLL bll = new T_FileAttach_BLL();
                        T_FileAttach_MDL mdl = new T_FileAttach_MDL();
                        mdl.AttachName  = fileName;
                        mdl.AttachPath  = savePath + fileName;
                        mdl.CreateDate  = DateTime.Now;
                        mdl.PriKeyValue = tSingleProjectID;
                        mdl.OrderIndex  = 0;
                        mdl.Flag        = "Company_Registration";

                        if (Hid_ghxkz.Value != "" && ghxkzh.Text.Trim() != "")
                        {
                            Hid_ghxkz.Value = "";
                            mdl.AttachCode  = SystemSet.EumProject_Credentials.ghxkz.ToString();
                            bll.Add(mdl);
                        }
                        else if (Hid_sgxkz.Value != "" && sgxkzh.Text.Trim() != "")
                        {
                            Hid_sgxkz.Value = "";
                            mdl.AttachCode  = SystemSet.EumProject_Credentials.sgxkz.ToString();
                            bll.Add(mdl);
                        }
                        else if (Hid_other.Value != "")
                        {
                            mdl.AttachCode = SystemSet.EumProject_Credentials.other.ToString();
                            bll.Add(mdl);
                        }
                    }
                }
            }
        }
        protected void lbtnAdd_Click(object sender, EventArgs e)
        {
            List <string> sellist = ctrlGridEx1.GetSelects();

            if (sellist.Count > 0)
            {
                List <int> rowIndexList = ctrlGridEx1.GetSelectsRowIndexList();
                for (int i = 0; i < sellist.Count; i++)
                {
                    FileUpload f1       = (FileUpload)ctrlGridEx1.Rows[rowIndexList[i]].Cells[5].Controls[0];
                    string     savePath = "/Upload/CompanySignet/";
                    string     fileName = Common.Common.SaveFile(Server.MapPath(savePath), f1.PostedFile, "Signet_", "jpg,gif,bmp");

                    if (fileName != "")
                    {
                        string SystemInfoID           = sellist[i];
                        Model.T_SystemInfo_MDL sysMDL = (new BLL.T_SystemInfo_BLL()).GetModel(Common.ConvertEx.ToInt(SystemInfoID));

                        T_FileAttach_BLL fileAttBLL = new T_FileAttach_BLL();
                        T_FileAttach_MDL fileAttMDL = new T_FileAttach_MDL();

                        fileAttMDL.Flag        = sysMDL.CurrentType;
                        fileAttMDL.PriKeyValue = Common.ConvertEx.ToInt(_CompanyID);
                        fileAttMDL.AttachPath  = savePath + fileName;
                        fileAttMDL.AttachName  = sysMDL.CurrentTypeCNName;
                        fileAttMDL.AttachCode  = sysMDL.SystemInfoCode;
                        fileAttMDL.CreateDate  = DateTime.Now;
                        fileAttMDL.OrderIndex  = 1;
                        fileAttMDL.AttachID    = Common.ConvertEx.ToInt(ctrlGridEx1.Rows[rowIndexList[i]].Cells[1].Text);

                        if (fileAttMDL.AttachID == 0)
                        {
                            fileAttBLL.Add(fileAttMDL);
                        }
                        else
                        {
                            fileAttBLL.Update(fileAttMDL);
                        }
                    }
                }
                BindGrid();
            }
        }
        public string DeleteFileAttach(int attachID)
        {
            string flag = SystemSet._RETURN_SUCCESS_VALUE;

            try {
                T_FileAttach_MDL fileAttachMDL = fileAttachBLL.GetModel(attachID);
                if (fileAttachMDL != null)
                {
                    PublicModel.writeLog(SystemSet.EumLogType.AddData.ToString(), string.Concat("T_FileAttach;key=", attachID,
                                                                                                ";SingleProjectID=", fileAttachMDL.PriKeyValue, ";AttachCode=", fileAttachMDL.AttachCode, ";删除工程证书附件"));

                    fileAttachBLL.Delete(attachID);
                }
            } catch (Exception ex) {
                flag = SystemSet._RETURN_FAILURE_VALUE + ex.Message;
                Common.LogUtil.Debug(this, "删除工程证书附件", ex);
            }
            return(flag);
        }