public string BatchAddFBAdmins(List<T_SYS_FBADMIN> lstAdmin) { using (FbAdminBLL UserRoleBll = new FbAdminBLL()) { //先清缓存 if (lstAdmin.Count() > 0) { List<T_SYS_USER> users = this.GetSysUserAllInfos(); for (int i = 0; i < lstAdmin.Count(); i++) { T_SYS_USER EntUser = new T_SYS_USER(); EntUser = users.Where(p=>p.EMPLOYEEID == lstAdmin[i].EMPLOYEEID).FirstOrDefault(); string keyString = "GetSysUserRoleByUser" + EntUser.SYSUSERID; WCFCache.Current[keyString] = null; } } return UserRoleBll.AddFbAdmin(lstAdmin); } }
//改 public bool SysUserInfoUpdate(T_SYS_USER obj) { Tracer.Debug("修改了用户信息" + obj.USERNAME + obj.EMPLOYEENAME); using (SysUserBLL UserBll = new SysUserBLL()) { string keyString = "GetUserByEmployeeID" + obj.EMPLOYEEID; WCFCache.Current[keyString] = null; //清空即时通讯的缓存 string InstantkeyString = "ImInstantLoginUsers"; WCFCache.Current[InstantkeyString] = null; //Tracer.Debug("修改了用户信息"+obj.USERNAME + obj.EMPLOYEENAME); return UserBll.UpdateSysUserInfo(obj); } }
public bool SysUserInfoUpdateForEmployeeLeft(T_SYS_USER obj,string StrOwnerCompanyid,string StrPostid,bool IsMain) { Tracer.Debug("修改了用户信息" + obj.USERNAME + obj.EMPLOYEENAME); using (SysUserBLL UserBll = new SysUserBLL()) { string keyString = "GetUserByEmployeeID" + obj.EMPLOYEEID; WCFCache.Current[keyString] = null; //清空即时通讯的缓存 string InstantkeyString = "ImInstantLoginUsers"; WCFCache.Current[InstantkeyString] = null; //Tracer.Debug("修改了用户信息"+obj.USERNAME + obj.EMPLOYEENAME); return UserBll.UpdateSysUserInfoForEmployeeLeftOffice(obj, StrOwnerCompanyid, StrPostid, IsMain); } }
public bool EmployeeEntryAddDefaultRole(T_SYS_USER user, string companyID, string compayName, string deptID, string postID, string employeeID, string employeePostID) { using (SysUserRoleBLL UserBll = new SysUserRoleBLL()) { return UserBll.EmployeeEntryAddDefaultRole( user, companyID, compayName, deptID, postID, employeeID, employeePostID); } }
public void SysUserInfoAddORUpdate(T_SYS_USER obj, ref string strMsg) { using (SysUserBLL UserBll = new SysUserBLL()) { //清空即时通讯的缓存 string keyString = "ImInstantLoginUsers"; WCFCache.Current[keyString] = null; UserBll.SysUserInfoAddORUpdate(obj, ref strMsg); } }
//增 public string SysUserInfoAdd(T_SYS_USER obj) { using (SysUserBLL UserBll = new SysUserBLL()) { string returnStr = ""; if (!this.IsExistSysUserInfo(obj.USERNAME)) { bool sucess = UserBll.AddSysUserInfo(obj); if (sucess == false) { returnStr = "添加系统用户失败"; } else { //清空即时通讯的缓存 string keyString = "ImInstantLoginUsers"; WCFCache.Current[keyString] = null; } } else { returnStr = "系统用户已经存在"; } return returnStr; } }
//添加用户角色 public bool UserRoleBatchAddInfos(T_SYS_ROLE[] RoleList, T_SYS_USER userobj, string StrUserName, DateTime AddDate) { using (SysUserRoleBLL UserRoleBll = new SysUserRoleBLL()) { //先清缓存GetSysUserRoleByUser string keyString = "GetSysUserRoleByUser" + userobj.SYSUSERID; WCFCache.Current[keyString] = null; return UserRoleBll.BatchAddUserRoleInfo(userobj, RoleList, StrUserName, AddDate); } }
protected void Page_Load(object sender, EventArgs e) { username = dosomething(this.Request["username"]); password = dosomething(this.Request["password"]); filename = this.Request["filename"]; filename = HttpUtility.UrlDecode(filename); //password = HttpUtility.UrlDecode(password); //string bb = HttpUtility.UrlDecode(""); //username = "******"; //password = "******"; //string aa = HttpUtility.UrlEncode(password); //string cc = HttpUtility.UrlDecode(aa); //filename = "UpLoadFiles\\初始化公司\\OA\\Archives\\在线通讯录20101227(1).xls"; T_SYS_USER user = new T_SYS_USER(); user = perm.UserLogin(username, password); //if() if (user != null) { System.IO.Stream iStream = null; string filepath = Server.MapPath(filename); string files = System.IO.Path.GetFileName(filepath); long dataToRead; int length; byte[] buffer = new Byte[300000]; System.IO.FileInfo file = new System.IO.FileInfo(filepath); try { iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read); // Total bytes to read: dataToRead = iStream.Length; Response.ContentType = "application/octet-stream"; Response.Charset = "UTF-8"; Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8)); // Read the bytes. while (dataToRead > 0) { // Verify that the client is connected. if (Response.IsClientConnected) { // Read the data in buffer. length = iStream.Read(buffer, 0, 300000); // Write the data to the current output stream. Response.OutputStream.Write(buffer, 0, length); // Flush the data to the HTML output. Response.Flush(); buffer = new Byte[300000]; dataToRead = dataToRead - length; } else { //prevent infinite loop if user disconnects dataToRead = -1; } } Response.Clear(); Response.End(); } catch (Exception ex) { // Trap the error, if any. Response.Write("Error : " + ex.Message); Response.Clear(); Response.End(); } finally { if (iStream != null) { //Close the file. iStream.Close(); } Response.Clear(); Response.End(); } } else { string StrScript; string strMsg = "你无权限下载,请联系管理员!"; StrScript = ("<script language=javascript>"); StrScript += ("alert('" + strMsg + "');"); //StrScript += ("window.location='" + URL + "';"); StrScript += ("</script>"); System.Web.HttpContext.Current.Response.Write(StrScript); } }