Example #1
0
        public SmartCollection<SampleTest> GetData(string token, object recordIds)
        {
            SmartCollection<SampleTest> results = new SmartCollection<SampleTest>();
            this.RecordList = new List<string>();
            User user = new User();
            int userId = 0;
            this.Token = token;
            this.RecordList.AddRange(((object[])recordIds).Select(x => x.ToString()).ToList());

            if (AppLib.DesignMode) {
                LoadSampleTestMockData(ref results);
            }else {
                try {
                    using (SystemDAO systemDao = new SystemDAO()) {
                        userId = systemDao.GetToken(new Guid(this.Token));
                    }
                    if (userId > 0) {
                        using (UserDAO userDao = new UserDAO()) {
                            user = userDao.GetUser(userId);
                        }
                        using (SampleDAO ordersDao = new SampleDAO()) {
                            results = ordersDao.GetWorkOrders(RecordList, new Identification() { Token = new Guid(this.Token), UserId = (int)user.UserId });
                        }
                    }
                }catch (Exception) {
                    throw;
                }
            }
            return results;
        }