Example #1
0
 /// <summary>
 /// LocationInfoEditSave
 /// </summary>
 /// <param name="Model"></param>
 /// <param name="LoginUserID"></param>
 /// <param name="RID"></param>
 /// <returns></returns>
 public static string LocationInfoEditSave(LocationInfoModel Model, string LoginUserID, string RID)
 {
     using (var db = new VehicleEntities())
     {
         var List = db.T_Location.Where(t => t.RID == RID).FirstOrDefault();
         List.LastUpdDate = DateTime.Now;
         List.LastUpdUser = LoginUserID;
         List.name        = Model.name;
         List.longitude   = Model.longitude;
         List.latitude    = Model.latitude;
         if (Model.Radius != "")
         {
             List.Radius = Convert.ToInt32(Model.Radius);
         }
         int success = db.SaveChanges();
         if (success > 0)
         {
             ViewModel.Result result = new Result();
             result.success = true;
             result.message = "保存成功";
             return(JsonConvert.SerializeObject(result));
         }
         else
         {
             return(JsonConvert.SerializeObject(new ViewModel.Result()
             {
                 success = true, message = "保存失败"
             }));
         }
     }
 }
        /// <summary>
        /// LocationInfoEditSave
        /// </summary>
        public void LocationInfoEditSave()
        {
            LocationInfoModel Model       = new LocationInfoModel();
            string            LoginUserID = Request["LoginUserID"];
            string            RID         = Request["Data"];

            Model.name      = Request["Location"];
            Model.longitude = Request.Form["longitude"];
            Model.latitude  = Request.Form["latitude"];
            Model.Radius    = Request.Form["Radius"];
            string text = Vehicle_LocationInfo.LocationInfoEditSave(Model, LoginUserID, RID);

            Response.ContentType = "Application/json";
            Response.Write(text);
            Response.End();
        }
        /// <summary>
        /// LocationInfoSearch
        /// </summary>
        public void LocationInfoSearch()
        {
            rows = Request["rows"] == null ? 10 : int.Parse(Request["rows"]);
            page = Request["page"] == null ? 1 : int.Parse(Request["page"]);
            string            Location  = Request.Form["Location"];
            string            BeginDate = Request.Form["BeginDate"];
            string            EndData   = Request.Form["EndDate"];
            LocationInfoModel Model     = new LocationInfoModel();

            Model.name          = Location;
            Model.Create_Time   = BeginDate;
            Model.Create_Time_E = EndData;
            string Json = Vehicle_LocationInfo.LocationInfoSearch(rows, page, Model);

            Response.ContentType = "Application/json";
            Response.Write(Json);
            Response.End();
        }
Example #4
0
        /// <summary>
        /// LocationInfoSearch
        /// </summary>
        /// <param name="row"></param>
        /// <param name="page"></param>
        /// <param name="Model"></param>
        /// <returns></returns>
        public static string LocationInfoSearch(int row, int page, LocationInfoModel Model)
        {
            DateTime?Begin_Date;
            DateTime?End_Date;

            if (Model.Create_Time != "")
            {
                Begin_Date = Convert.ToDateTime(Model.Create_Time);
            }
            else
            {
                Begin_Date = null;
            }
            if (Model.Create_Time_E != "")
            {
                End_Date = Convert.ToDateTime(Model.Create_Time_E);
            }
            else
            {
                End_Date = null;
            }

            using (var db = new VehicleEntities())
            {
                var Searchlist = from hdr in db.T_Location.Where(p =>
                                                                 (p.LastUpdDate >= Begin_Date || Begin_Date == null) &&
                                                                 (p.LastUpdDate <= End_Date || End_Date == null) &&
                                                                 (p.name.Contains(Model.name) || string.IsNullOrEmpty(Model.name))
                                                                 ).OrderByDescending(p => p.LastUpdDate).Skip((page - 1) * row).Take(row)
                                 select hdr;
                var AllList = from hdr in db.T_Location.Where(p =>
                                                              (p.LastUpdDate >= Begin_Date || Begin_Date == null) &&
                                                              (p.LastUpdDate <= End_Date || End_Date == null) &&
                                                              (p.name.Contains(Model.name) || string.IsNullOrEmpty(Model.name))
                                                              ).OrderByDescending(p => p.LastUpdDate)
                              select hdr;
                var    total    = AllList.Count();
                string JsonGrid = JsonConvert.SerializeObject(new { total = total, rows = Searchlist });
                return(JsonGrid);
            }
        }
Example #5
0
 /// <summary>
 /// LocationInfoAddSave
 /// </summary>
 /// <param name="Model"></param>
 /// <param name="LoginUserID"></param>
 /// <returns></returns>
 public static string LocationInfoAddSave(LocationInfoModel Model, string LoginUserID)
 {
     using (var db = new VehicleEntities())
     {
         int        LocationIDMax = Convert.ToInt32(db.T_Location.Select(t => t.locationID).Max());
         int        LocationID    = LocationIDMax + 1;
         T_Location List          = new T_Location();
         List.CreateUser  = LoginUserID;
         List.CreateDate  = Convert.ToDateTime(Model.Create_Time);
         List.LastUpdDate = Convert.ToDateTime(Model.Create_Time);
         List.LastUpdUser = LoginUserID;
         List.name        = Model.name;
         List.longitude   = Model.longitude;
         List.latitude    = Model.latitude;
         if (Model.Radius != "")
         {
             List.Radius = Convert.ToInt32(Model.Radius);
         }
         List.locationID = LocationID.ToString();
         List.RID        = Guid.NewGuid().ToString();
         db.AddToT_Location(List);
         int success = db.SaveChanges();
         if (success > 0)
         {
             ViewModel.Result result = new Result();
             result.success = true;
             result.message = "保存成功";
             return(JsonConvert.SerializeObject(result));
         }
         else
         {
             return(JsonConvert.SerializeObject(new ViewModel.Result()
             {
                 success = true, message = "保存失败"
             }));
         }
     }
 }
        public ActionResult Location(Guid id, QueryModel oq, QueryModel cq, bool?showOpen)
        {
            IPagedList <ClosedWorkOrderModel> closedOrders = _workOrderService.GetLocationClosedWorkOrdersModels(cq, id);
            IPagedList <OpenWorkOrderModel>   openOrders   = _workOrderService.GetLocationOpenWorkOrdersModels(oq, id);
            LocationAddressModel location     = _workOrderService.GetLocationInfo(id);
            LocationInfoModel    locationInfo = _workOrderService.GetSpecificLocationInfo(id);

            var locationItems = _locationService.GetSingleLocation(id).Select(l => new SelectListItem
            {
                Value = l.Id.ToString(),
                Text  = l.Name
            }).ToList();

            locationItems.Insert(0, new SelectListItem());

            var model = new LocationDetailsModel(Url)
            {
                LocationOpenOrders    = openOrders,
                LocationClosedOrders  = closedOrders,
                ShowOpen              = showOpen ?? true,
                Locations             = locationItems,
                ClosedWorkOrdersQuery = cq,
                OpenWorkOrdersQuery   = oq,
                Address1              = location.Address1,
                Address2              = location.Address2,
                City            = location.City,
                State           = location.State,
                PostalCode      = location.PostalCode,
                Name            = location.Name,
                LocationInfo    = locationInfo,
                LocationAddress = location
            };

            ViewData["ReturnToListUrl"] = TempData.ContainsKey("ReturnToListUrl")
                ? TempData["ReturnToListUrl"]
                : Url.Action("Index");
            return(View(model));
        }
Example #7
0
 public ActionResult selectcity(LocationInfoModel condtion, string PageId, string callback = null)
 {
     ViewBag.PageId   = PageId;
     ViewBag.condtion = condtion;
     return(View());
 }