示例#1
0
        public ActionResult Update(VIEW_MST_CAR car)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                return(this.JsonFormat(ModelState, status, "ERROR"));
            }
            var currCar = VIEW_MST_CAR.ToEntity(car);

            try
            {
                carB.Modify(currCar, "UserId", "CAR_NUM", "CAR_BRAND", "CAR_CATEGORY", "CAR_COLOR", "CAR_REMARK");
                status = true;
            }
            catch (Exception e)
            {
                return(this.JsonFormat(status, status, SysOperate.Update));
            }
            return(this.JsonFormat("/Admin/Car/CarInfo", status, SysOperate.Update.ToMessage(status), status));
        }
示例#2
0
        public ActionResult Add(VIEW_MST_CAR car)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                return(this.JsonFormat(ModelState, status, "ERROR"));
            }
            var currCar   = VIEW_MST_CAR.ToEntity(car);
            var ReturnUrl = Request["returnurl"];

            try
            {
                carB.Add(currCar);
                status = true;
            }
            catch (Exception e)
            {
                return(this.JsonFormat(status, status, SysOperate.Add));
            }
            return(this.JsonFormat(ReturnUrl, status, SysOperate.Update.ToMessage(status), status));
        }
示例#3
0
        public ActionResult CarDetail(string car_cd)
        {
            VIEW_MST_CAR car = new VIEW_MST_CAR()
            {
                CAR_CD = "CAR" + Common.Tools.Get8Digits(), AddTime = DateTime.Now
            };
            var usernum = Request.QueryString["userNum"];

            if (!string.IsNullOrEmpty(usernum))
            {
                car.UserId = usernum;
            }
            var list       = sys_UsurLogin.LoadListBy(su => su.LOGIN_ID == OperateContext.Current.UsrId).Select(su => su.SLSORG_CD);
            var memberlist = DataSelect.ToListViewModel(VIEW_YX_weiUser.ToListViewModel(userB.GetListBy(u => list.Contains(u.TREE_NODE_ID), u => u.userRelname)));

            ViewBag.MEMBERS   = memberlist;
            ViewBag.ReturnUrl = Request["returnurl"];
            ViewDetailPage page = new ViewDetailPage(HttpContext);

            ViewBag.IsView = page.IsView;
            //ViewBag.CurrentID = id;
            ViewBag.IsUpdate = "N";
            ViewBag.TYPE     = "Update";
            var model = carB.Get(u => u.CAR_CD == car_cd);

            if (model == null)
            {
                ViewBag.TYPE = "Add"; ViewBag.IsUpdate = "Y";
                return(View(car));
            }
            if (memberlist.Select(m => m.Value).Contains(model.UserId))
            {
                ViewBag.IsUpdate = "Y";
            }
            return(View(VIEW_MST_CAR.ToViewModel(model)));
        }