Exemplo n.º 1
0
        /// <summary>
        /// 获取标签历史位置根据PersonnelID
        /// </summary>
        /// <param name="personnelID"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public static IList <Position> GetHistoryPositonsByPersonnelID(int personnelID, DateTime start, DateTime end)
        {
            using (LocationBll db = new LocationBll(false, false, false))
            {
                DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1, 0, 0, 0, 0));
                long     startTotalMilliseconds = (long)(start - startTime).TotalMilliseconds;
                long     endTotalMilliseconds   = (long)(end - startTime).TotalMilliseconds;
                if (startTotalMilliseconds >= endTotalMilliseconds)
                {
                    return(null);
                }
                if (startTotalMilliseconds < 0)
                {
                    startTotalMilliseconds = 0;
                }
                if (endTotalMilliseconds < 0)
                {
                    endTotalMilliseconds = 0;
                }

                IQueryable <Position> info = from u in db.Position.DbSet
                                             where personnelID == u.PersonnelID && u.Time >= startTotalMilliseconds && u.Time <= endTotalMilliseconds
                                             select u;
                //var info = db.Position.DbSet.Where(c => c.Time >=startTotalMilliseconds && c.Time <= endTotalMilliseconds).ToList();
                IList <Position> tempList = info.ToList();
                return(tempList.ToWCFList());
            }
        }
        public ActionResult Index()
        {
            LocationBll     bll  = new LocationBll();
            List <Location> list = bll.Gets(x => x.ParentId == 0).ToList();

            return(View(list));
        }
        // GET: Treeview
        public ActionResult OnDemand()
        {
            List <Location> all = new List <Location>();

            all = new LocationBll().Gets(x => x.ParentId == 0).ToList();
            return(View(all));
        }
        public ViewResult Details(int id)
        {
            LocationBll bll      = new LocationBll();
            Location    location = bll.Gets(x => x.Id == id).SingleOrDefault();

            return(View(location));
        }
        public ActionResult List()
        {
            LocationBll     bll  = new LocationBll();
            List <Location> list = bll.GetAll().ToList();

            return(View(list));
        }
        public JsonResult GetLocationsByParentId(int?parentId)
        {
            int             id   = parentId == null ? 0 : parentId.Value;
            LocationBll     bll  = new LocationBll();
            List <Location> list = bll.Gets(location => location.ParentId == id).ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
        public JsonResult UpdateLocationParent(int locationId, int parentId)
        {
            LocationBll bll      = new LocationBll();
            Location    location = bll.Get(x => x.Id == locationId);

            location.ParentId = parentId;
            bll.Update(location);
            return(Json(new { HasError = "false", Messages = "Yer değiştirme başarılı." }));
        }
Exemplo n.º 8
0
 public TaskBatchHandler(String userId, SyncResult syncResult)
     : base(userId, syncResult)
 {
     TaskBll = new TaskBll();//application.getTaskService();
     LocationBll = new LocationBll();//new LocationBll(application);
     AttachmentBll = new AttachmentBll();//application.AttachmentService();
     //SyncStatusService = new SyncStatusService(application.getDBHelper());
     TaskSyncCollector = new TaskSyncCollector(userId);
     TaskSyncedJsonBll = new TaskSyncedJsonBll();//new TaskSyncedJsonService(application.getDBHelper());
     SyncStatusBll = new SyncStatusBll();// new SyncStatusService(application.getDBHelper());
 }
        public JsonResult GetSubMenu(string pid)
        {
            //this action for Get Sub Menus from Database and return  as json data
            List <Location> locations = new List <Location>();
            int             pID       = 0;

            int.TryParse(pid, out pID);

            locations = new LocationBll().Gets(x => x.ParentId == pID).ToList();
            return(new JsonResult {
                Data = locations, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ToUserFromStoreViewModel()
        {
            StoreBll           = new StoreBll();
            CompanyBll         = new CompanyBll();
            LocationBll        = new LocationBll();
            OperationBll       = new OperationBll();
            ToUserFromStore    = new ToUserFromStoreModel();
            Company            = new ObservableCollection <CompanyModel>();
            Location           = new ObservableCollection <LocationModel>();
            SearchCommand      = new RelayCommand <string>(OnSearch);
            SubmitCommand      = new RelayCommand(OnSubmit);
            OperationTypeEnums = new OperationTypeEnums();
            StatusEnums        = new StatusEnums();

            BindData();
        }
Exemplo n.º 11
0
        public static void ImportKKSFromFile <T>(FileInfo file)
            where T : IKKSCode, new()
        {
            Log.InfoStart("KKSCodeHelper.ImportKKSFromFile");
            if (file.Exists == false)
            {
                Log.Info("不存在文件:" + file.FullName);
            }
            LocationBll    bll     = new LocationBll();
            List <KKSCode> kksList = bll.KKSCodes.ToList();

            if (kksList != null && kksList.Count == 0)
            {
                List <KKSCode> list = CreateKKSCodeListFromFile <KKSCode>(file);
                bll.KKSCodes.AddRange(bll.Db, list); //新增的部分
            }
            Log.InfoEnd("KKSCodeHelper.ImportKKSFromFile");
        }
Exemplo n.º 12
0
        // Constructor
        public ChangeUserViewModel()
        {
            CompanyBll   = new CompanyBll();
            LocationBll  = new LocationBll();
            OperationBll = new OperationBll();

            Company  = new ObservableCollection <CompanyModel>();
            Location = new ObservableCollection <LocationModel>();

            SearchCommand = new RelayCommand <string>(OnSearch);
            SubmitCommand = new RelayCommand(OnSubmit);
            CleanCommand  = new RelayCommand(onClean);

            OperationTypeEnums = new OperationTypeEnums();
            StatusEnums        = new StatusEnums();

            BindData();
        }
        private void BindData()
        {
            var companies = CompanyBll.GetAllList(x => x.IsActive == true);

            foreach (var item in companies)
            {
                Company.Add(new CompanyModel()
                {
                    Id = item.Id, Name = item.Name, Number = item.Number
                });
            }

            var locations = LocationBll.GetAllList(x => x.IsActive == true);

            foreach (var item in locations)
            {
                Location.Add(new LocationModel()
                {
                    Id = item.Id, Name = item.Name
                });
            }
        }
Exemplo n.º 14
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            LocationBll bll  = new LocationBll();
            int         mode = int.Parse(ConfigurationManager.AppSettings["DataInitMode"]);//0:EF,1:Sql

            bll.Init(mode);

            TagPositionController tp = new TagPositionController();

            Thread th2 = new Thread(ShowAlarmController.NSQListen);

            th2.Start();

            Reference rf = Reference.Instance();

            rf.Init();
        }
        public ActionResult GetLocationFromId(int Id)
        {
            Location location;

            try
            {
                location = new LocationBll().Get(u => u.Id == Id);
                HasError = false;
            }
            catch
            {
                HasError = true;
                Message  = "Kullanıcı kayıt sırasında hata aldı.";
                return(Json(new { HasError = base.HasError, Message = base.Message }, JsonRequestBehavior.AllowGet));
            }
            if (location == null)
            {
                HasError = true;
                Message  = "Kullanıcı bulunamadı.";
                return(Json(new { HasError = base.HasError, Message = base.Message }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { HasError = base.HasError, Result = location }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetAllLocations()
        {
            List <Location> list = new LocationBll().GetAll().ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UpdateLocation(int id)
        {
            Location model = new LocationBll().Get(x => x.Id == id);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
 public PhysicalTopologySP(LocationBll db)
 {
     this.db = db;
 }
 public PhysicalTopologySP()
 {
     db = new LocationBll(false, false, false);
 }
        public ActionResult Updatee(int id)
        {
            Location model = new LocationBll().Get(x => x.Id == id);

            return(View(model));
        }
        public ActionResult GetLocationList(PagingRequest request)
        {
            var response = new LocationBll().GetLocationList(request);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 22
0
        /// <summary>
        /// 获取物理逻辑拓扑
        /// </summary>
        /// <returns></returns>
        public static PhysicalTopology GetPhysicalTopologyTree()
        {
            try
            {
                using (LocationBll db = new LocationBll(false, false, false))
                {
                    Log.InfoStart("GetPhysicalTopologyTree");


                    //LocationBll dbEx = new LocationBll(false, true, false);
                    //List<PhysicalTopology> list = dbEx.PhysicalTopologys.ToList();
                    //PhysicalTopology root = list[0];
                    //return root;

                    List <PhysicalTopology> list = db.PhysicalTopologys.ToList();

                    List <TransformM> transformMs = db.TransformMs.ToList();
                    foreach (PhysicalTopology p in list)
                    {
                        p.Transfrom = transformMs.Find((item) => item.Id == p.TransfromId);
                    }

                    List <NodeKKS> kksList = db.NodeKKSs.ToList();
                    foreach (PhysicalTopology p in list)
                    {
                        p.Nodekks = kksList.Find((item) => item.Id == p.NodekksId);
                    }

                    List <Bound> bounds = db.Bounds.ToList();
                    List <Point> points = db.Points.ToList();
                    foreach (Point point in points)
                    {
                        Bound bound = bounds.Find(i => i.Id == point.BoundId);
                        if (bound != null)
                        {
                            bound.AddPoint(point);
                        }
                    }

                    foreach (PhysicalTopology p in list)
                    {
                        p.InitBound = bounds.Find((item) => item.Id == p.InitBoundId);
                        p.EditBound = bounds.Find((item) => item.Id == p.EditBoundId);
                    }

                    List <DevInfo>          leafNodes = db.DevInfos.ToList();
                    List <PhysicalTopology> roots     = TreeHelper.CreateTree(list, leafNodes);

                    Log.InfoEnd("GetPhysicalTopologyTree");

                    if (roots.Count > 0)
                    {
                        return(roots[0]);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("GetPhysicalTopologyTree", ex);
                return(null);
            }
        }
        public ActionResult GetByParentId(int ParentId)
        {
            List <Location> locationList = new LocationBll().GetByParentId(ParentId);

            return(Json(locationList, JsonRequestBehavior.AllowGet));
        }
        public ActionResult GetById(int id)
        {
            Location location = new LocationBll().Get(x => x.Id == id);

            return(Json(new { HasError = false, Result = location }, JsonRequestBehavior.AllowGet));
        }