コード例 #1
0
ファイル: AccountController.cs プロジェクト: gowhy/MicroWish
 public ActionResult NoPermission()
 {
     var model =new MsgModel
     {
         Title = "操作失败",
         Message = "没有权限",
         JumpUrl = Request.UrlReferrer != null ? Request.UrlReferrer.ToString() : Url.Action("Index", "Home"),
         WaitSecond = 30
     };
     return View("_Message", model);
 }
コード例 #2
0
ファイル: AccountController.cs プロジェクト: gowhy/MicroWish
 public ActionResult LogOff()
 {
     FormsService.SignOut();
     var msg = new MsgModel
                   {
                       WaitSecond = 3,
                       JumpUrl = Url.Action("LogOn"),
                       Title = "登出成功",
                       Message = "成功登出"
                   };
     return View(msg);
 }
コード例 #3
0
ファイル: BaseController.cs プロジェクト: gowhy/MicroWish
 protected ActionResult Message(MsgModel model)
 {
     if (Request.IsAjaxRequest())
     {
         return Json(new JsonMessage(model.Type, model.Message), JsonRequestBehavior.AllowGet);
     }
     return View("_Message", model);
 }
コード例 #4
0
ファイル: ProductController.cs プロジェクト: gowhy/LoveBank
        public ActionResult BindMachine(MachineModel machine, int? page, int? pageSize)
        {
            var pageNumber = page ?? 1;
            var size = pageSize ?? PageSize;
            using (LoveBankDBContext db = new LoveBankDBContext())
            {

                var t_mp = db.T_MachineProduct;
                var t_m = db.T_Machine;
                var t_d = db.T_Department;
                var t_p = db.T_Product;

                if (t_p.Count(x=>x.AddUserId==AdminUser.ID&&x.ID== machine.ProductId)==0)
                {
                    MsgModel msgModel = new MsgModel();
                    msgModel.Message = "无权限操作,只能绑定自己新增的产品";
                    msgModel.WaitSecond =- 1;
                    msgModel.Title = "绑定机器无权操作";
                    return Message(msgModel);
                }

                var list = from m in t_m
                           join d in t_d on m.DeptId equals d.Id
                           join m in t_mp on m.ID equals m.MachineId into pm
                           let mlist = pm.Where(x => x.ProductId == machine.ProductId)
                           from m1 in mlist.DefaultIfEmpty()
                           select new MachineModel
                           {
                               Address = m.Address,
                               AddTime = m.AddTime,
                               AddUserDeptId = m.AddUserDeptId,
                               DeptId = m.DeptId,
                               Desc = m.Desc,
                               Id = m.ID,
                               MachineCode = m.MachineCode,
                               Name = m.Name,
                               State = m.State,
                               Title = m.Title,
                               ProductId = m1.ProductId,
                               Department = d

                           };

                list = list.Where(x => x.State != RowState.删除 && x.DeptId.IndexOf(AdminUser.DeptId) > -1);
                if (!string.IsNullOrEmpty(machine.Name)) list = list.Where(x => x.Name.Contains(machine.Name));
                if (!string.IsNullOrEmpty(machine.MachineCode)) list = list.Where(x => x.MachineCode == machine.MachineCode);
                if (!string.IsNullOrEmpty(machine.DeptId)) list = list.Where(x => x.DeptId.IndexOf(machine.DeptId) > -1);

                ViewBag.ProductId = machine.ProductId;
                machine.MachineModelList = list.OrderByDescending(x => x.Id).ToPagedList(pageNumber - 1, size);

                var list2 = t_d.Where(x => x.Level <= 6 && x.Id.IndexOf(AdminUser.DeptId) > -1).ToList();
                if (!string.IsNullOrEmpty(machine.DeptId))
                {
                    list2.FirstOrDefault(x => x.Id == machine.DeptId).IsCheck = true;
                    //list2[list2.FindIndex(x => x.Id == machine.DeptId)].IsCheck = true;
                }

                ViewData["Department_List"] = HelpSerializer.JSONSerialize<List<Department>>(list2);

                return View(machine);
            }
        }
コード例 #5
0
ファイル: ProductController.cs プロジェクト: gowhy/LoveBank
        public ActionResult Delete(int id)
        {
            var ad = DbProvider.D<Product>().FirstOrDefault(x => x.ID == id);

            if (ad.AddUserId != AdminUser.ID)
            {
                MsgModel msgModel = new MsgModel();
                msgModel.Message = "无权限操作只能删除自己新增的数据";
                msgModel.WaitSecond = -1;
                msgModel.Title = "权限不足";
                return Message(msgModel);
            }

            ad.State = LoveBank.Core.Domain.Enums.RowState.删除;
            DbProvider.SaveChanges();
            return Success("删除成功");
        }
コード例 #6
0
        public ActionResult AuditingVolAddScore(int id)
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                var t_v = db.T_Vol;
                var t_sr = db.T_VolAddScoreRecorde;
                var t_tp = db.T_TeamProject;

                var list = from s in t_sr
                           join v in t_v on s.VolID equals v.ID
                           join p in t_tp on s.TeamProjectId equals p.ID
                           select new VolAddSocreRecordeModel
                           {
                               AddScore = s.AddScore,
                               AddTime = s.AddTime,
                               State = s.State,
                               AuditingState = s.AuditingState,
                               AuditingMsg = s.AuditingMsg,
                               Msg = s.Msg,
                               AuditingTime = s.AuditingTime,
                               ID = s.ID,
                               DeptId = s.DeptId,
                               Vol = v,
                               TeamProjectName = p.Name

                           };
                VolAddSocreRecordeModel volMode = list.SingleOrDefault(x => x.ID == id);
                if (volMode.AuditingState == AuditingState.审核通过)
                {
                    MsgModel mo = new MsgModel();
                    mo.Message = "已审核通过,不能在审核";
                    mo.WaitSecond = -1;
                    mo.Title = "错误";
                    return View("_Message", mo);
                    //return Error("已审核通过,不能在审核");
                }

                return PartialView(volMode);
            }
        }