Exemplo n.º 1
0
        //
        // GET: /FMM/Route/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (RouteServiceClient client = new RouteServiceClient())
            {
                MethodReturnResult <Route> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    RouteViewModel viewModel = new RouteViewModel()
                    {
                        Name        = result.Data.Key,
                        Status      = result.Data.Status,
                        CreateTime  = result.Data.CreateTime,
                        Creator     = result.Data.Creator,
                        Description = result.Data.Description,
                        Editor      = result.Data.Editor,
                        EditTime    = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> SaveModify(RouteViewModel model)
        {
            using (RouteServiceClient client = new RouteServiceClient())
            {
                MethodReturnResult <Route> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.Status      = model.Status;
                    result.Data.RouteType   = model.RouteType;
                    result.Data.Description = model.Description;
                    result.Data.Editor      = User.Identity.Name;
                    result.Data.EditTime    = DateTime.Now;
                    MethodReturnResult rst = await client.ModifyAsync(result.Data);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(FMMResources.StringResource.Route_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Copy(string key)
        {
            using (RouteServiceClient client = new RouteServiceClient())
            {
                MethodReturnResult <Route> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    RouteViewModel model = new RouteViewModel()
                    {
                        Name        = result.Data.Key,
                        RouteType   = result.Data.RouteType,
                        Description = result.Data.Description,
                        Status      = result.Data.Status,
                        Creator     = User.Identity.Name,
                        CreateTime  = DateTime.Now,
                        Editor      = User.Identity.Name,
                        EditTime    = DateTime.Now,
                        ParentName  = key
                    };
                    return(PartialView("_CopyPartial", model));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                    return(PartialView("_CopyPartial"));
                }
            }
        }
Exemplo n.º 4
0
        //
        // GET: /FMM/RouteStep/
        public async Task <ActionResult> Index(string routeName)
        {
            using (RouteServiceClient client = new RouteServiceClient())
            {
                MethodReturnResult <Route> result = await client.GetAsync(routeName ?? string.Empty);

                if (result.Code > 0 || result.Data == null)
                {
                    return(RedirectToAction("Index", "Route"));
                }
                ViewBag.Route = result.Data;
            }

            using (RouteStepServiceClient client = new RouteStepServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "SortSeq",
                        Where   = string.Format("Key.RouteName='{0}'", routeName)
                    };
                    MethodReturnResult <IList <RouteStep> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new RouteStepQueryViewModel()
            {
                RouteName = routeName
            }));
        }