private void btnStart_Click(object sender, EventArgs e) { try { COrganizeEntity currentOrg = new COrganizeEntity().Load(_currentUser.GetUserOrganize().Org_Id); CResourceEntity orgRes = new CResourceEntity().Load(currentOrg.Org_Resource); //string rootDir = Context.Server.MapPath("~/App_data"); string rootDir = ConfigurationManager.AppSettings["UserData"]; _temperoryFolder = rootDir + DateTime.Now.ToString("yyyy-MM-dd") + currentOrg.Org_Name; DirectoryInfo di = Directory.CreateDirectory(_temperoryFolder); Context.Session["temperoryFolder"] = _temperoryFolder; string outputPath = _temperoryFolder + @"\"; outputPath += currentOrg.Org_Name; outputPath += ".zip"; string orignPath = orgRes.MakeFullPath(); ZipFiles(orignPath, outputPath); LinkParameters objlinkParameters = new LinkParameters(); objlinkParameters.Target = "_self"; Link.Open(new Gizmox.WebGUI.Common.Gateways.GatewayReference(this, "Download"), objlinkParameters); //System.IO.File.Delete(outputPath); //di.Delete(); } catch (Exception ex) { MessageBox.Show("系统错误:" + ex.Message, "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void btnOK_Click(object sender, EventArgs e) { COrganizeEntity org = new COrganizeEntity().Load(_currentUser.Usr_Organize); org.Org_Mail = txtEmail.Text.Trim(); org.Org_MailPassword = txtPassword.Text; org.Org_MailSmtp = txtSmtp.Text; org.Org_SmtpNumber = Convert.ToInt32(txtNumber.Text);//端口号 if (chkBoxSSL.Checked) { org.Org_MailSSL = (int)SSL.CHECKED; } else { org.Org_MailSSL = (int)SSL.UNCHECK; } org.Org_SMTPUsrName = txtUsrName.Text; string pwd = txtUsrPwd.Text; if (pwd != txtSurePwd.Text) { MessageBox.Show("口令与确认口令不一致!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } org.Org_SMTPPassword = pwd; org.Update(); }
protected CUserEntity CreateUser(CUserEntity newUser) { try { COrganizeEntity organize = new COrganizeEntity(_connString); List <COrganizeEntity> organizelst = new List <COrganizeEntity>(); organizelst = organize.GetObjectList("this.Org_Name ='" + _orgName + "'"); int orgRes = organizelst[0].Org_Resource; // create resource for user's folder CResourceEntity folderRes = new CResourceEntity(_connString); folderRes.Res_Name = ""; folderRes.Res_Parent = orgRes; folderRes.Res_Type = (int)RESOURCETYPE.FOLDERRESOURCE; folderRes.Res_Id = folderRes.Insert(); folderRes.Res_Name = folderRes.Res_Id.ToString() + newUser.Usr_Member; folderRes.Update(); // create user's folder //String userPath = folderRes.MakeFullPath(); String userPath = _rootPath + "\\" + folderRes.Res_Name; Directory.CreateDirectory(userPath); // create user newUser.Usr_Resource = folderRes.Res_Id; newUser.ConnString = _connString; newUser.Usr_Id = newUser.Insert(); return(newUser); } catch (Exception e) { throw e; } }
private void MailUsrCrl_Load(object sender, EventArgs e) { COrganizeEntity org = new COrganizeEntity().Load(_currentUser.Usr_Organize); txtEmail.Text = org.Org_Mail; txtPassword.Text = ""; txtSmtp.Text = org.Org_MailSmtp; }
public COrganizeEntity CreateOrganize(String organizeName) { try { // create resource for this organize CResourceEntity res = new CResourceEntity(_connString); res.Res_Name = _orgName; res.Res_Parent = 0; res.Res_Type = (int)RESOURCETYPE.ORGANIZERESOURCE; res.Res_Id = res.Insert(); // create default storage folder named as organize resource id String organizePath = System.IO.Path.Combine(_path, res.Res_Id.ToString() + _orgName); Directory.CreateDirectory(organizePath); _rootPath = organizePath; CSearchDAL.AddSearchFolder(_rootPath); // create resource for default folder of organize CResourceEntity folderRes = new CResourceEntity(_connString); folderRes.Res_Name = res.Res_Id.ToString() + _orgName; folderRes.Res_Parent = 0; folderRes.Res_Type = (int)RESOURCETYPE.FOLDERRESOURCE; folderRes.Res_Id = folderRes.Insert(); // Create organize entity COrganizeEntity organize = new COrganizeEntity(_connString); organize.Org_Name = _orgName; organize.Org_Resource = folderRes.Res_Id; organize.Insert(); // create archive folder for organzie String archivePath = System.IO.Path.Combine(organizePath, "归档目录"); Directory.CreateDirectory(archivePath); // create resource for archive folder CResourceEntity archiveRes = new CResourceEntity(_connString); archiveRes.Res_Name = "归档目录"; archiveRes.Res_Parent = folderRes.Res_Id; archiveRes.Res_Type = (int)RESOURCETYPE.FOLDERRESOURCE; archiveRes.Res_Id = archiveRes.Insert(); organize.Org_ArchiveRes = archiveRes.Res_Id; organize.Update(); return(organize); } catch (Exception ex) { throw (ex); } }
public virtual void ShareResource(CUserEntity user, int resource) { CResourceEntity res = new CResourceEntity(user.ConnString).Load(resource); COrganizeEntity org = new COrganizeEntity(user.ConnString).Load(user.Usr_Organize); if (res.IsChild(user.Usr_Resource) || (user.Usr_Type == (int)USERTYPE.ORGANIZEADMIN && res.IsChild(org.Org_ArchiveRes))) { ShareForm shareForm = new ShareForm(); shareForm.CurrentUser = user; shareForm.ResourceId = resource; shareForm.ShowDialog(); } else { throw new Exception("不能共享此目录!"); } }
private void leftNavigationTabs_SelectedIndexChanged(object sender, EventArgs e) { this.mainSplit.Panel2.Controls.Clear( ); if (leftNavigationTabs.SelectedItem == this.myDocPage || leftNavigationTabs.SelectedItem == this.archiveTab || leftNavigationTabs.SelectedItem == this.shareSpaceTab || leftNavigationTabs.SelectedItem == this.orgManageTab) { DirTree dirTree = (DirTree)leftNavigationTabs.SelectedItem.Controls [0]; ActiveRigthPanel(dirTree.FileListUI); } else if (leftNavigationTabs.SelectedItem == this.systemPage) { CFunction func = sysFunctionTree.SelectedFunction; if (func != null && func.Ui != null) { ActiveRigthPanel(func.Ui); } } else if (leftNavigationTabs.SelectedItem == this.myInfoPage) { CFunction func = myinfofunctionTree.SelectedFunction; if (func != null && func.Ui != null) { ActiveRigthPanel(func.Ui); } } //删除由于备份产生的临时文件夹——赵英武 if (leftNavigationTabs.SelectedItem != systemPage) { string path = (string)Context.Session["temperoryFolder"]; if (System.IO.Directory.Exists(path)) { COrganizeEntity org = new COrganizeEntity().Load(_currentUser.Usr_Organize); string filePath = path + @"\" + org.Org_Name + ".zip"; System.IO.File.Delete(filePath); System.IO.Directory.Delete(path); Context.Session["temperoryFolder"] = ""; } } }
private void btnSave_Click(object sender, EventArgs e) { COrganizeEntity org = new COrganizeEntity().Load(_currentUser.Usr_Organize); org.Org_Mail = txtEmail.Text.Trim(); if (txtPassword.Text == "") { MessageBox.Show("密码不能为空!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } org.Org_MailPassword = txtPassword.Text; org.Org_MailSmtp = txtSmtp.Text; org.Org_SmtpNumber = Convert.ToInt32(txtNumber.Text);//端口号 if (chkBoxSSL.Checked) { org.Org_MailSSL = (int)SSL.CHECKED; } else { org.Org_MailSSL = (int)SSL.UNCHECK; } org.Update(); }
public CUserEntity CreateAdminlUser() { COrganizeEntity org = new COrganizeEntity(_connString); List <COrganizeEntity> organizelst = new List <COrganizeEntity>(); organizelst = org.GetObjectList("this.Org_Name ='" + _orgName + "'"); int orgId = organizelst[0].Org_Id; CUserEntity newUser = new CUserEntity(); newUser.Usr_Member = _member; newUser.Usr_Name = _memberName; newUser.Usr_Organize = orgId; newUser.Usr_Password = _memberPwd; newUser.Usr_Email = _memberEmail; try { // create admin newUser.Usr_Type = (int)USERTYPE.ORGANIZEADMIN; CUserEntity user = CreateUser(newUser); // add acls to admin, organize acl, root dir acl COrganizeEntity organize = new COrganizeEntity(_connString); organize = organize.Load(user.Usr_Organize); /* * CACLEntity acl1 = new CACLEntity(ConnString); * acl1.Acl_CreateTime = DateTime.Now; * acl1.Acl_Creator = Usr_Id; * acl1.Acl_Operation = 0; * acl1.Acl_Resource = organize.Org_Id; * acl1.Acl_Role = user.Usr_Id; * acl1.Acl_RType = (int)ACLROLETYPE.USERROLE; * acl1.Acl_Id = acl1.Insert(); */ CACLEntity acl2 = new CACLEntity(_connString); acl2.Acl_CreateTime = DateTime.Now; acl2.Acl_Creator = user.Usr_Id; acl2.Acl_Operation = (int)ACLOPERATION.WRITE; acl2.Acl_Resource = organize.Org_Resource; acl2.Acl_Role = user.Usr_Id; acl2.Acl_RType = (int)ACLROLETYPE.USERROLE; acl2.Acl_Id = acl2.Insert(); CACLEntity acl3 = new CACLEntity(_connString); acl3.Acl_CreateTime = DateTime.Now; acl3.Acl_Creator = user.Usr_Id; acl3.Acl_Operation = (int)ACLOPERATION.READ; acl3.Acl_Resource = organize.Org_Resource; acl3.Acl_Role = user.Usr_Id; acl3.Acl_RType = (int)ACLROLETYPE.USERROLE; acl3.Acl_Id = acl3.Insert(); return(user); } catch (Exception e) { throw e; } }