/// <summary>
        /// 下载附件
        /// </summary>
        /// <param name="fileId"></param>
        public void DownLoad(string fileId)
        {
            fileId = UtilsHelper.Decrypt(fileId);
            AttachmentModel fileMode = Global.Business.ServiceProvider.AttachmentService.GetById(int.Parse(fileId));

            UtilsHelper.FileDownload(fileMode.FileAccessPrefix, fileMode.FileVirtualPath, fileMode.FileName, (UtilConstants.ServerType)fileMode.FileServerType);
        }
Exemple #2
0
 /// <summary>
 /// 删除文件
 /// </summary>
 /// <param name="fileId">文件Id</param>
 /// <returns></returns>
 public ActionResult DeleteAttachment(string fileId)
 {
     try
     {
         fileId = UtilsHelper.Decrypt(fileId);
         ServiceProvider.AttachmentService.DeleteById(int.Parse(fileId));
         return(Content("OK"));
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
Exemple #3
0
        public string GetUserList(string orgId)
        {
            orgId = UtilsHelper.Decrypt(orgId);
            IList <UserModel> userList = ServiceProvider.UserService.GetListByOrgId(Convert.ToInt32(orgId));
            IList <Hashtable> userRole = ServiceProvider.UserService.GetAllUserRole();

            StringBuilder sb       = new StringBuilder();
            StringBuilder roleName = new StringBuilder();
            int           count    = 0;

            sb.Append("{\"data\":[");
            foreach (var user in userList)
            {
                roleName.Clear();
                IEnumerable <Hashtable> where = userRole.Where(ur => int.Equals(ur["UserId"], user.UserId));
                foreach (var role in where)
                {
                    roleName.AppendFormat("{0}{1}", role["RoleName"], count == 0 ? "" : "<br/>");
                    count += 1;
                }


                sb.AppendFormat("[\"<a href='#' onclick='fnNewWindow({6});return false;'>角色设置</a><br/>"
                                //+ "<a href='#' onclick='fnConfirmWithoutF5('确定重置账户【{0}】密码?','/SysManage/User/ResetPWD?userId={8}');return false;'>重置密码</a>"
                                + "<a href='#' onclick='fnUpdateUser({7});return false;'>编辑资料</a><br/>"
                                + "<a href='#' onclick='fnResetPWD({7});return false;'>重置密码</a><br/>"
                                + "<a href='#' onclick='fnOpenCloseUser({8});return false;'>禁用启用</a><br/>"
                                + "<a href='#' onclick='fnDeleteUser({9});return false;'>删除用户</a><br/>"
                                + "<a href='#' onclick='fnSaleManageDeptWindow({9});return false;'>管理部门</a><br/>"
                                //+ "<a href='#' onclick='fnTestLogin({12});return false;'>登录验证</a>"
                                + "\",\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\""
                                + "],", user.UserName,
                                //user.Sex ? "男" : "女", user.JobNo, user.DepartName, user.Duty, user.IsEnabled == 0 ? "启用" : "禁用",
                                //user.EmployeeState == 0 ? "在职" : "离职", roleName, user.UserId, user.UserId, user.UserId, user.UserId, user.UserId);
                                user.JobNo, user.DepartName, user.Duty,
                                roleName, user.UserId, user.UserId, user.UserId, user.UserId, user.UserId);
            }
            if (userList.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]}");
            return(sb.ToString());
        }
        public ActionResult LoginUser(string userId)
        {
            UserModel user = null;

            if (!string.IsNullOrWhiteSpace(userId))
            {
                userId = UtilsHelper.Decrypt(userId);
                user   = ServiceProvider.UserService.GetById(int.Parse(userId));
            }
            else
            {
                user = Session["LoginUser"] as UserModel;
            }
            string org = "";

            foreach (UserManageDepartModel u in user.manageDepartList)
            {
                org = org + ServiceProvider.OrgService.GetByCode(u.OrgCode).OrgName + "   ";
            }
            ViewBag.org = org;
            return(View(user));
        }
        /// <summary>
        /// 保存管理部门
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public void SaveUserManageDepart(int userId, string orgCode)
        {
            //UserModel user = Global.Business.ServiceProvider.UserService.GetById(userId);
            DBProvider.SalesDAO.DeleteManageDepartByUserId(userId);
            if (string.IsNullOrEmpty(orgCode))
            {
                return;
            }

            IList <OrgModel> orgList = Global.Business.ServiceProvider.OrgService.GetAll();
            string           code    = string.Empty;

            string[] idArray = orgCode.Split(',');
            for (int i = 0; i < idArray.Length; i++)
            {
                if (string.IsNullOrEmpty(idArray[i]))
                {
                    break;
                }
                idArray[i] = UtilsHelper.Decrypt(idArray[i]);
                code       = Global.Business.ServiceProvider.OrgService.GetById(int.Parse(idArray[i])).OrgCode;
                DBProvider.SalesDAO.AddManageDepart(userId, int.Parse(idArray[i]), code);
            }
        }
Exemple #6
0
        public ActionResult OrgListPage(string orgId, string orgName)
        {
            //"Z0pic1pKNFlYK0U9 "
            IList <Hashtable> orgList = ServiceProvider.OrgService.GetByParentId(Convert.ToInt32(UtilsHelper.Decrypt(orgId)));

            //IList<Hashtable> orgList = ServiceProvider.OrgService.GetByParentId(StrUtils.ToInt32(orgId, 0));
            return(View(orgList));
        }