Exemplo n.º 1
0
        public ActionResult ChangeRole(string userAD, string[] selRole)
        {
            var res = new TRes
            {
                bok = false
            };

            if (string.IsNullOrEmpty(userAD) || null == selRole || 0 == selRole.Length)
            {
                res.msg = "参数有误";
                return(Json(res));
            }
            if (!CommonInfo.HasRight(TRightID.ADMIN))
            {
                res.msg = "只有管理员才可以修改权限";
                return(Json(res));
            }

            string errmsg  = string.Empty;
            var    sRoleID = SysUserInfo.ChangeRole(userAD, selRole, out errmsg);

            res.bok  = true;
            res.data = sRoleID;
            return(Json(res));
        }
Exemplo n.º 2
0
 public ActionResult ModifyHCData()
 {
     if (!CommonInfo.HasRight(TRightID.MODIFY))
     {
         return(new HttpUnauthorizedResult("没有权限!"));
     }
     return(View());
 }
Exemplo n.º 3
0
        public ActionResult UserMng()
        {
            if (!CommonInfo.HasRight(TRightID.ADMIN))
            {
                return(RedirectToAction("Signin", "Login"));
                //return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
            }

            ViewBag.rolesList = SysUserInfo.LoadRoles();
            return(View());
        }
Exemplo n.º 4
0
        public ActionResult DownloadMonthData(string selKind)
        {
            if (!CommonInfo.HasRight(TRightID.DOWNLOAD))
            {
                return(new HttpUnauthorizedResult());
            }
            var fn  = string.Format("{0}_{1}.xlsx", "MonthData", selKind);
            var bys = WLE_Data.GetMonthData_Down(selKind);

            if (null == bys)
            {
                return(new EmptyResult());
            }
            return(File(bys, ExcelType.XLSX_MIME, fn));
        }
Exemplo n.º 5
0
        public ActionResult DownloadData(string dType, string bu, string startWeek, string endWeek, string selYear)
        {
            if (!CommonInfo.HasRight(TRightID.DOWNLOAD))
            {
                return(new HttpUnauthorizedResult());
            }
            switch (dType)
            {
            case "WeekData":
                return(DownloadData_WeekData(bu, startWeek, endWeek));

            //case "MonthData":
            //    return DownloadData_MonthData(bu, startWeek, endWeek);
            case "HCData":
                return(DownloadData_HCData(bu, selYear));
            }
            return(new EmptyResult());
        }
Exemplo n.º 6
0
        public ActionResult UploadData(string dataType, HttpPostedFileBase file)
        {
            var res = new TRes
            {
                bok = false,
                msg = ""
            };

            if (!ModelState.IsValid)
            {
                res.msg = "数据无效";
                ModelState.AddModelError("", res.msg);
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
            if (!CommonInfo.HasRight(TRightID.UPLOAD))
            {
                res.msg = "没有上传权限";
                ModelState.AddModelError("", res.msg);
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(dataType))
            {
                res.msg = "请选择数据类型";
                ModelState.AddModelError("", res.msg);
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
            if (file == null || file.ContentLength == 0)
            {
                res.msg = "文件有问题";
                ModelState.AddModelError("", res.msg);
                return(Json(res, JsonRequestBehavior.AllowGet));
            }

            var  sErrImp = string.Empty;
            bool bImp    = BLLHelper.ImpUpload(dataType, file, out sErrImp);

            res.bok = bImp;
            if (!bImp)
            {
                res.msg = sErrImp;
                ModelState.AddModelError("", res.msg);
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }