protected void btnDelete_Click(object sender, EventArgs e) { try { for (int i = 0; i < gvFile.Rows.Count; i++) { CheckBox ckb = gvFile.Rows[i].FindControl("ckbChoose") as CheckBox; if (ckb.Checked == true) { int fileid = Convert.ToInt32(gvFile.DataKeys[i].Value); CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); DeleteFile(file.FileName); file.Delete(); CanYou.OA.BLL.FileInfo.DelFileEmployee(fileid); if (MessageInfo.IsMessageOfFile(file.FileId.ToString())) { //ɾ����Ϣ MessageInfo.DelMessageOfMemo(fileid.ToString()); } } } gvDataBind(); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('������Ϣ:" + Ex.Message + "');", true); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { for (int i = 0; i < gvFile.Rows.Count; i++) { CheckBox ckb = gvFile.Rows[i].FindControl("ckbChoose") as CheckBox; if (ckb.Checked == true) { int fileid = Convert.ToInt32(gvFile.DataKeys[i].Value); CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); DeleteFile(file.FileName); file.Delete(); CanYou.OA.BLL.FileInfo.DelFileEmployee(fileid); if (MessageInfo.IsMessageOfFile(file.FileId.ToString())) { //删除消息 MessageInfo.DelMessageOfMemo(fileid.ToString()); } } } gvDataBind(); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('错误信息:" + Ex.Message + "');", true); } }
protected void Page_Load(object sender, EventArgs e) { int fileid = Int32.Parse(Request.QueryString["fileid"]);//获取文件的ID CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); string fileName = file.FileName; //获取桌面路径 //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)); //string DeskPath = Server.MapPath("~\\Files"); DownLoads(fileName); }
public FileInfo GetFileInfoById(int FileId) { FileInfo fileInfo = null;// try { fileInfo = new FileInfo(FileId); } catch (AppException) { return null; } return fileInfo; }
protected void Page_Load(object sender, EventArgs e) { int fileid = Int32.Parse(Request.QueryString["fileid"]);//获取文件的ID int emid = Convert.ToInt32(Session["EmployeeId"]); CanYou.OA.BLL.FileInfo.UpdateDocument(fileid, emid); if (MessageInfo.IsMessageOfFile(fileid.ToString())) { //删除消息 MessageInfo.DelMsgOfBoth(fileid.ToString(), emid); } CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); string fileName = file.FileName; //获取桌面路径 //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)); //string DeskPath = Server.MapPath("~\\Files\\File"); DownLoads(fileName); }
protected void Page_Load(object sender, EventArgs e) { int fileid = Int32.Parse(Request.QueryString["fileid"]);//获取文件的ID if (MessageInfo.IsMessageOfFile(fileid.ToString())) { //删除消息 MessageInfo.DelMessageOfMemo(fileid.ToString()); } CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); string fileName = file.FileName; file.IsMsg = 1; file.Save(); // Response.Redirect("~/ShareManage/RecvFile.aspx"); //获取桌面路径 //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)); //string DeskPath=Server.MapPath("~\\Files"); DownLoads(fileName); }
/// <summary> /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据 /// </summary> /// <param name="pPageIndex">页数</param> /// <param name="pPageSize">每页列表</param> /// <param name="pOrderBy">排序</param> /// <param name="pSortExpression">排序字段</param> /// <param name="pRecordCount">列表行数</param> /// <returns>数据分页</returns> public static List<FileInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount) { if(pPageIndex<=1) pPageIndex=1; List< FileInfo> list = new List< FileInfo>(); Query q = File .CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression,pOrderBy.ToString()); FileCollection collection=new FileCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (File file in collection) { FileInfo fileInfo = new FileInfo(); LoadFromDAL(fileInfo, file); list.Add(fileInfo); } pRecordCount=q.GetRecordCount(); return list; }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List<FileInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(FileInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return CachedEntityCommander.GetCache(cacheKey) as List< FileInfo>; } else { List< FileInfo> list =new List< FileInfo>(); FileCollection collection=new FileCollection(); Query qry = new Query(File.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach(File file in collection) { FileInfo fileInfo= new FileInfo(); LoadFromDAL(fileInfo,file); list.Add(fileInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(FileInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return list; } }
/// <summary> /// 复制一个对象,采用硬编码的方式,避免反射的低效 /// </summary> /// <param name="pIndustryTypeInfoFrom"></param> /// <param name="pIndustryTypeInfoTo"></param> public static void Copy(FileInfo pFileInfoFrom, FileInfo pFileInfoTo) { pFileInfoTo.FileId = pFileInfoFrom.fileId; pFileInfoTo.FileTypeId = pFileInfoFrom.fileTypeId; pFileInfoTo.FileName = pFileInfoFrom.fileName; pFileInfoTo.SendEmployeeId = pFileInfoFrom.sendEmployeeId; pFileInfoTo.RecvEmployeeId = pFileInfoFrom.recvEmployeeId; pFileInfoTo.SendTime = pFileInfoFrom.sendTime; pFileInfoTo.Memo = pFileInfoFrom.memo; pFileInfoTo.IsCommon = pFileInfoFrom.isCommon; pFileInfoTo.IsDelete = pFileInfoFrom.isDelete; pFileInfoTo.IsMsg = pFileInfoFrom.isMsg; pFileInfoTo.FilePermissionId = pFileInfoFrom.filePermissionId; pFileInfoTo.Loaded=pFileInfoFrom.Loaded; }
protected void Page_Load(object sender, EventArgs e) { int fileid = Int32.Parse(Request.QueryString["fileid"]);//��ȡ�ļ���ID int emid = Convert.ToInt32(Session["EmployeeId"]); CanYou.OA.BLL.FileInfo.UpdateDocument(fileid, emid); if (MessageInfo.IsMessageOfFile(fileid.ToString())) { //ɾ����Ϣ MessageInfo.DelMsgOfBoth(fileid.ToString(),emid); } CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); string fileName = file.FileName; //��ȡ����·�� //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)); //string DeskPath = Server.MapPath("~\\Files\\File"); DownLoads(fileName); }
protected void Page_Load(object sender, EventArgs e) { int fileid = Int32.Parse(Request.QueryString["fileid"]);//��ȡ�ļ���ID CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); string fileName = file.FileName; //��ȡ����·�� //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)); //string DeskPath = Server.MapPath("~\\Files"); DownLoads(fileName); }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List< FileInfo> pList, FileCollection pCollection) { foreach (File file in pCollection) { FileInfo fileInfo = new FileInfo(); LoadFromDAL(fileInfo, file ); pList.Add(fileInfo); } }
public void DeleteById(FileInfo pFileInfo) { FileInfo fileInfo = new FileInfo(pFileInfo.FileId); fileInfo.Delete(); }
protected void Page_Load(object sender, EventArgs e) { int fileid = Int32.Parse(Request.QueryString["fileid"]);//��ȡ�ļ���ID if(MessageInfo.IsMessageOfFile(fileid.ToString())) { //ɾ����Ϣ MessageInfo.DelMessageOfMemo(fileid.ToString()); } CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(fileid); string fileName = file.FileName; file.IsMsg = 1; file.Save(); // Response.Redirect("~/ShareManage/RecvFile.aspx"); //��ȡ����·�� //string DeskPath = Convert.ToString(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)); //string DeskPath=Server.MapPath("~\\Files"); DownLoads(fileName); }
protected void btnSendFile_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int emid = Convert.ToInt32(Session["EmployeeId"]); EmployeeInfo em = (EmployeeInfo)Session["Employee"]; //��ȡ�ļ��� string name = this.UpFile.FileName; DateTime sendtime = DateTime.Now; if (!CanYou.OA.BLL.FileInfo.IsDocumentSame(name)) { CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(); file.FileName = name; file.FileTypeId = Convert.ToInt32(ddlFileType.SelectedValue.ToString()); file.SendEmployeeId = emid; file.Memo = txtMemo.Text.ToString(); file.SendTime = sendtime; file.IsCommon = 1; file.FilePermissionId=Convert.ToInt32(ddlFilePermit.SelectedValue); file.Save(); if (ddlFilePermit.SelectedItem.Text.ToString() == "����") { DataTable EmTb = MessageInfo.getEmployeeId(emid); string[] strto = new String[EmTb.Rows.Count]; for (int i = 0; i < EmTb.Rows.Count; i++) { MessageInfo.Msgs1(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"]), file.FileId, "~/ShareManage/DownloadDocument.aspx", "���й����ĵ�:"+name, em.EmployeeName,"daiyue",name); EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"])); strto[i] = ems.Qq.ToString(); } //MessageInfo.SendMailS(strto, "OA�µ���Ϣ", "���й����ĵ�:"+name); DataTable dt=MessageInfo.getEmployeeId1(); for (int j = 0; j < dt.Rows.Count; j++) { FileEmployeeInfo fileem = new FileEmployeeInfo(); fileem.FileId = file.FileId; fileem.EmployeeId = Convert.ToInt32(dt.Rows[j]["EmployeeId"]); fileem.IsMsg = 0; fileem.IsDelete = 0; fileem.Save(); } } else { DataTable EmTb = MessageInfo.getEmployeeIdOf(emid, ddlFilePermit.SelectedItem.Text.ToString()); string[] strto = new String[EmTb.Rows.Count]; for (int i = 0; i < EmTb.Rows.Count; i++) { MessageInfo.Msgs1(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"]), file.FileId, "~/ShareManage/DownloadDocument.aspx", "���й����ĵ�:" + name, em.EmployeeName, "daiyue", name); EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"])); strto[i] = ems.Qq.ToString(); } MessageInfo.SendMailS(strto, "OA�µ���Ϣ", "���й����ĵ�:"+name); DataTable dt = MessageInfo.getEmployeeIdOf1(ddlFilePermit.SelectedItem.Text.ToString()); { for (int j = 0; j < dt.Rows.Count; j++) { FileEmployeeInfo fileem = new FileEmployeeInfo(); fileem.FileId = file.FileId; fileem.EmployeeId = Convert.ToInt32(dt.Rows[j]["EmployeeId"]); fileem.IsMsg = 0; fileem.IsDelete = 0; fileem.Save(); } } } //�ļ��ϴ���ַ��Ŀ¼������ͨ��IIS���豾������ΪFTP������ //string FileSaveUri = @"ftp://192.168.11.70/www/Files/Documents/"; ////FTP�û������룬���DZ������û������� //string ftpUser = "******"; //string ftpPassWord = "******"; //SendFiles(FileSaveUri, ftpUser, ftpPassWord); this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/Documents/" + UpFile.FileName)); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�ϴ��ɹ���');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ĵ����Ѵ��ڣ�����������');</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('�ϴ�ʧ�ܣ�" + ex.Message + "');", true); } } }
/// <summary> /// 复制为另一个对象 /// </summary> /// <param name="pIndustryTypeInfoTo"></param> public void CopyTo(FileInfo pFileInfoTo) { Copy(this, pFileInfoTo); }
//从后台获取数据 internal static void LoadFromDAL(FileInfo pFileInfo, File pFile) { pFileInfo.fileId = pFile.FileId; pFileInfo.fileTypeId = pFile.FileTypeId; pFileInfo.fileName = pFile.FileName; pFileInfo.sendEmployeeId = pFile.SendEmployeeId; pFileInfo.recvEmployeeId = pFile.RecvEmployeeId; pFileInfo.sendTime = pFile.SendTime; pFileInfo.memo = pFile.Memo; pFileInfo.isCommon = pFile.IsCommon; pFileInfo.isDelete = pFile.IsDelete; pFileInfo.isMsg = pFile.IsMsg; pFileInfo.filePermissionId = pFile.FilePermissionId; pFileInfo.Loaded=true; }
public object SaveFileInfo(FileInfo fileInfo) { fileInfo.Save(); return fileInfo . FileId; }
//数据持久化 internal static void SaveToDb(FileInfo pFileInfo, File pFile,bool pIsNew) { pFile.FileId = pFileInfo.fileId; pFile.FileTypeId = pFileInfo.fileTypeId; pFile.FileName = pFileInfo.fileName; pFile.SendEmployeeId = pFileInfo.sendEmployeeId; pFile.RecvEmployeeId = pFileInfo.recvEmployeeId; pFile.SendTime = pFileInfo.sendTime; pFile.Memo = pFileInfo.memo; pFile.IsCommon = pFileInfo.isCommon; pFile.IsDelete = pFileInfo.isDelete; pFile.IsMsg = pFileInfo.isMsg; pFile.FilePermissionId = pFileInfo.filePermissionId; pFile.IsNew=pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pFile.Save(UserName); } catch(Exception ex) { LogManager.getInstance().getLogger(typeof(FileInfo)).Error(ex); if(ex.Message.Contains("插入重复键"))//违反了唯一键 { throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pFileInfo.fileId = pFile.FileId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(FileInfo))) { ResetCache(); } }
protected void btnSendFile_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int emid = Convert.ToInt32(Session["EmployeeId"]); EmployeeInfo em = (EmployeeInfo)Session["Employee"]; //获取文件名 string name = this.UpFile.FileName; DateTime sendtime = DateTime.Now; if (!CanYou.OA.BLL.FileInfo.IsFileSame(name)) { string[] strto = new String[lbxRecv.Items.Count]; for (int i = 0; i < lbxRecv.Items.Count; i++) { CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(); file.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value); file.FileName = name; file.FileTypeId = Convert.ToInt32(ddlFileType.SelectedValue.ToString()); file.SendEmployeeId = emid; file.Memo = txtMemo.Text.ToString(); file.SendTime = sendtime; file.IsCommon = 0; file.IsDelete = 0; file.IsMsg = 0; file.Save(); MessageInfo Msg = new MessageInfo(); Msg.Msg = "您收到新文件:" + name; Msg.Url = "~/ShareManage/RecvFile.aspx"; Msg.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value); Msg.Memo = file.FileId.ToString(); Msg.EmployeeName = em.EmployeeName; Msg.MsgType = "daiyue"; Msg.MsgTime = DateTime.Now.ToString("yyyy-MM-dd"); Msg.MsgTitle = name; Msg.Save(); EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(lbxRecv.Items[0].Value)); strto[i] = ems.Qq.ToString(); } //文件上传地址根目录,这里通过IIS架设本地主机为FTP服务器 //string FileSaveUri = @"ftp://192.168.11.70/www/Files/File/"; ////FTP用户名密码,就是本机的用户名密码 //string ftpUser = "******"; //string ftpPassWord = "******"; //SendFiles(FileSaveUri, ftpUser, ftpPassWord); this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/File/" + UpFile.FileName)); MessageInfo.SendMailS(strto, "OA新消息", "您收到新文件"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('发送成功!');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('该文件名已存在,请重命名!');</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('发送失败:" + ex.Message + "');", true); } } }
protected void btnSendFile_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int emid = Convert.ToInt32(Session["EmployeeId"]); EmployeeInfo em = (EmployeeInfo)Session["Employee"]; //��ȡ�ļ��� string name = this.UpFile.FileName; DateTime sendtime = DateTime.Now; if (!CanYou.OA.BLL.FileInfo.IsFileSame(name)) { string[] strto = new String[lbxRecv.Items.Count]; for (int i = 0; i < lbxRecv.Items.Count; i++) { CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(); file.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value); file.FileName = name; file.FileTypeId = Convert.ToInt32(ddlFileType.SelectedValue.ToString()); file.SendEmployeeId = emid; file.Memo = txtMemo.Text.ToString(); file.SendTime = sendtime; file.IsCommon = 0; file.IsDelete = 0; file.IsMsg = 0; file.Save(); MessageInfo Msg = new MessageInfo(); Msg.Msg = "���յ����ļ�:"+name; Msg.Url = "~/ShareManage/RecvFile.aspx"; Msg.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value); Msg.Memo = file.FileId.ToString(); Msg.EmployeeName = em.EmployeeName; Msg.MsgType = "daiyue"; Msg.MsgTime = DateTime.Now.ToString("yyyy-MM-dd"); Msg.MsgTitle = name; Msg.Save(); EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(lbxRecv.Items[0].Value)); strto[i] = ems.Qq.ToString(); } //�ļ��ϴ���ַ��Ŀ¼������ͨ��IIS���豾������ΪFTP������ //string FileSaveUri = @"ftp://192.168.11.70/www/Files/File/"; ////FTP�û������룬���DZ������û������� //string ftpUser = "******"; //string ftpPassWord = "******"; //SendFiles(FileSaveUri, ftpUser, ftpPassWord); this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/File/" + UpFile.FileName)); MessageInfo.SendMailS(strto, "OA����Ϣ", "���յ����ļ�"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ͳɹ���');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ļ����Ѵ��ڣ�����������');</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + ex.Message + "');", true); } } }
protected void btnSendFile_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int emid = Convert.ToInt32(Session["EmployeeId"]); EmployeeInfo em = (EmployeeInfo)Session["Employee"]; //获取文件名 string name = this.UpFile.FileName; DateTime sendtime = DateTime.Now; if (!CanYou.OA.BLL.FileInfo.IsDocumentSame(name)) { CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo(); file.FileName = name; file.FileTypeId = Convert.ToInt32(ddlFileType.SelectedValue.ToString()); file.SendEmployeeId = emid; file.Memo = txtMemo.Text.ToString(); file.SendTime = sendtime; file.IsCommon = 1; file.FilePermissionId = Convert.ToInt32(ddlFilePermit.SelectedValue); file.Save(); if (ddlFilePermit.SelectedItem.Text.ToString() == "公用") { DataTable EmTb = MessageInfo.getEmployeeId(emid); string[] strto = new String[EmTb.Rows.Count]; for (int i = 0; i < EmTb.Rows.Count; i++) { MessageInfo.Msgs1(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"]), file.FileId, "~/ShareManage/DownloadDocument.aspx", "您有共享文档:" + name, em.EmployeeName, "daiyue", name); EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"])); strto[i] = ems.Qq.ToString(); } //MessageInfo.SendMailS(strto, "OA新的消息", "您有共享文档:"+name); DataTable dt = MessageInfo.getEmployeeId1(); for (int j = 0; j < dt.Rows.Count; j++) { FileEmployeeInfo fileem = new FileEmployeeInfo(); fileem.FileId = file.FileId; fileem.EmployeeId = Convert.ToInt32(dt.Rows[j]["EmployeeId"]); fileem.IsMsg = 0; fileem.IsDelete = 0; fileem.Save(); } } else { DataTable EmTb = MessageInfo.getEmployeeIdOf(emid, ddlFilePermit.SelectedItem.Text.ToString()); string[] strto = new String[EmTb.Rows.Count]; for (int i = 0; i < EmTb.Rows.Count; i++) { MessageInfo.Msgs1(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"]), file.FileId, "~/ShareManage/DownloadDocument.aspx", "您有共享文档:" + name, em.EmployeeName, "daiyue", name); EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(EmTb.Rows[i]["EmployeeId"])); strto[i] = ems.Qq.ToString(); } MessageInfo.SendMailS(strto, "OA新的消息", "您有共享文档:" + name); DataTable dt = MessageInfo.getEmployeeIdOf1(ddlFilePermit.SelectedItem.Text.ToString()); { for (int j = 0; j < dt.Rows.Count; j++) { FileEmployeeInfo fileem = new FileEmployeeInfo(); fileem.FileId = file.FileId; fileem.EmployeeId = Convert.ToInt32(dt.Rows[j]["EmployeeId"]); fileem.IsMsg = 0; fileem.IsDelete = 0; fileem.Save(); } } } //文件上传地址根目录,这里通过IIS架设本地主机为FTP服务器 //string FileSaveUri = @"ftp://192.168.11.70/www/Files/Documents/"; ////FTP用户名密码,就是本机的用户名密码 //string ftpUser = "******"; //string ftpPassWord = "******"; //SendFiles(FileSaveUri, ftpUser, ftpPassWord); this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/Documents/" + UpFile.FileName)); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('上传成功!');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('该文档名已存在,请重命名!');</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('上传失败:" + ex.Message + "');", true); } } }