Example #1
0
        public HttpResponseMessage GetEmployees(long id, [FromUri]long[] loc = null)
        {
            if (id <= 0)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            IEnumerable<Employee> output = null;
            IEnumerable<EmployeeModel> employees = null;
            if (!loc.IsNullOrEmpty())
            {
                JoinTableRepository<EmployeeModel, SkillsetModel> repository = new JoinTableRepository<EmployeeModel, SkillsetModel>();
                IEnumerable<string> employeeIds = repository.GetLeft(id).Select(x => x.EmpId).ToList();
                CommonRepository<MToMTableModel<EmployeeModel, LocationModel>> repositoryEmpLoc = new CommonRepository<MToMTableModel<EmployeeModel, LocationModel>>();
                employees = repositoryEmpLoc.GetBySpecification(new Specification<MToMTableModel<EmployeeModel, LocationModel>>(x => x.LeftItem.IsActive == true && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId) && loc.Contains(x.RightItem.Id))).Select(x => x.LeftItem);
                output = AutoMapper.MapCollection<EmployeeModel, Employee>(employees);
            }
            else
            {
                TryGetItemEmployees(id, out output);
            }

            if (output.IsNullOrEmpty())
            {
                return Request.CreateResponse(HttpStatusCode.NotFound);
            }

            Response<IEnumerable<Employee>> results = new Response<IEnumerable<Employee>>(output);
            return Request.CreateResponse(HttpStatusCode.OK, results);
        }
            public void Before_each_test()
            {
                ServicesRepository servicesRepository = new ServicesRepository(new ScutexEntities());
                CommonRepository commonRepository = new CommonRepository(new ScutexServiceEntities());

                AsymmetricEncryptionProvider asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                SymmetricEncryptionProvider symmetricEncryptionProvider = new SymmetricEncryptionProvider();
                ObjectSerializationProvider objectSerializationProvider = new ObjectSerializationProvider();
                NumberDataGenerator numberDataGenerator = new NumberDataGenerator();
                PackingService packingService = new PackingService(numberDataGenerator);
                MasterService masterService = new MasterService(commonRepository);

                CommonService commonService = new CommonService();
                KeyPairService keyPairService = new KeyPairService(commonService, commonRepository);

                ServiceStatusProvider serviceStatusProvider = new ServiceStatusProvider(symmetricEncryptionProvider, objectSerializationProvider, asymmetricEncryptionProvider);
                servicesService = new ServicesService(servicesRepository, serviceStatusProvider, packingService, null, null, null, null, null, null);

                controlService = new ControlService(symmetricEncryptionProvider, keyPairService, packingService, masterService, objectSerializationProvider, asymmetricEncryptionProvider);

                service = new Scutex.Model.Service();
                service.OutboundKeyPair = asymmetricEncryptionProvider.GenerateKeyPair(BitStrengths.High);
                service.InboundKeyPair = asymmetricEncryptionProvider.GenerateKeyPair(BitStrengths.High);
                service.ManagementInboundKeyPair = asymmetricEncryptionProvider.GenerateKeyPair(BitStrengths.High);
                service.ManagementOutboundKeyPair = asymmetricEncryptionProvider.GenerateKeyPair(BitStrengths.High);
            }
            public void Before_each_test()
            {
                clientLicenseRepoistory = new ClientLicenseRepository(objectSerializationProvider, symmetricEncryptionProvider);
                clientLicenseService = new ClientLicenseService(clientLicenseRepoistory);
                serviceProductsRepository = new ServiceProductsRepository(new ScutexServiceEntities());
                symmetricEncryptionProvider = new SymmetricEncryptionProvider();
                asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                hashingProvider = new HashingProvider();
                objectSerializationProvider = new ObjectSerializationProvider();
                numberDataGenerator = new NumberDataGenerator();
                packingService = new PackingService(numberDataGenerator);
                commonRepository = new CommonRepository(new ScutexServiceEntities());
                clientRepository = new ClientRepository(new ScutexServiceEntities());
                keyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider);
                masterService = new MasterService(commonRepository);
                activationLogRepository = new ActivationLogRepoistory(new ScutexServiceEntities());

                activationLogService = new ActivationLogService(activationLogRepository, hashingProvider);
                keyService = new KeyManagementService(clientRepository, licenseKeyService, activationLogService, hashingProvider, serviceProductsRepository);
                commonService = new CommonService();

                string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                path = path.Replace("file:\\", "");

                var mockCommonService = new Mock<ICommonService>();
                mockCommonService.Setup(common => common.GetPath()).Returns(path + "\\Data\\Client\\");

                string masterServiceDataText;

                using (TextReader reader = new StreamReader(path + "\\Data\\MasterService.dat"))
                {
                    masterServiceDataText = reader.ReadToEnd().Trim();
                }

                masterServiceData = objectSerializationProvider.Deserialize<MasterServiceData>(masterServiceDataText);

                var mockCommonRepository = new Mock<ICommonRepository>();
                mockCommonRepository.Setup(repo => repo.GetMasterServiceData()).Returns(masterServiceData);

                keyPairService = new KeyPairService(mockCommonService.Object, mockCommonRepository.Object);
                controlService = new ControlService(symmetricEncryptionProvider, keyPairService, packingService, masterService, objectSerializationProvider, asymmetricEncryptionProvider);
                servicesRepository = new ServicesRepository(new ScutexEntities());
                serviceStatusProvider = new ServiceStatusProvider(symmetricEncryptionProvider, objectSerializationProvider, asymmetricEncryptionProvider);
                licenseActiviationProvider = new LicenseActiviationProvider(asymmetricEncryptionProvider, symmetricEncryptionProvider, objectSerializationProvider);
                servicesService = new ServicesService(servicesRepository, serviceStatusProvider, packingService, licenseActiviationProvider, null, null, null, null, null);
                licenseKeyService = new LicenseKeyService(keyGenerator, packingService, clientLicenseService);
                activationService = new ActivationService(controlService, keyService, keyPairService, objectSerializationProvider, asymmetricEncryptionProvider, null, null);

                string serviceData;

                using (TextReader reader = new StreamReader(path + "\\Data\\Service.dat"))
                {
                    serviceData = reader.ReadToEnd().Trim();
                }

                service = objectSerializationProvider.Deserialize<Service>(serviceData);
            }
Example #4
0
        public async Task <string> getDocumentFile(string documentRecId)
        {
            try
            {
                CommonRepository repo = new CommonRepository();

                return(repo.getDocumentsBase64(Convert.ToInt64(documentRecId)));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public bool Edit(ViewModels.EditPostsRequestModel model)
        {
            //
            Entity.m_Posts m = new Entity.m_Posts();
            m.PostsId   = model.PostsId;
            m.Contents  = model.Contents;//Framework.Core.HtmlFilter.SanitizeHtml(model.Contents);
            m.LastDate  = DateTime.Now;
            m.Title     = Framework.Core.HtmlFilter.StripHtml(model.Title);
            m.ChannelId = model.ChannelId;
            CommonRepository repository = new CommonRepository();

            return(repository.Update(m));
        }
Example #6
0
    public async Task <int> AutoCheckInVolunteers()
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var volunteers = await db.Attendances
                         .Where(predicate : a =>
                                a.AttendanceTypeId == (int)AttendanceTypeId.Volunteer &&
                                a.CheckInDate == null)
                         .ToListAsync().ConfigureAwait(continueOnCapturedContext: false);

        volunteers.ForEach(action: v => v.CheckInDate = DateTime.UtcNow);
        return(await db.SaveChangesAsync().ConfigureAwait(continueOnCapturedContext: false));
    }
Example #7
0
        public override void Given()
        {
            CreateMapper();
            SeedLookupData();

            CommonServiceLogger         = new Logger <CommonService>(new NullLoggerFactory());
            TlLookupRepositoryLogger    = new Logger <GenericRepository <TlLookup> >(new NullLoggerFactory());
            TlLookupRepository          = new GenericRepository <TlLookup>(TlLookupRepositoryLogger, DbContext);
            FunctionLogRepositoryLogger = new Logger <GenericRepository <FunctionLog> >(new NullLoggerFactory());
            FunctionLogRepository       = new GenericRepository <FunctionLog>(FunctionLogRepositoryLogger, DbContext);
            CommonRepository            = new CommonRepository(DbContext);
            CommonService = new CommonService(CommonServiceLogger, CommonMapper, TlLookupRepository, FunctionLogRepository, CommonRepository);
        }
Example #8
0
        public bool EditNavigation(int navigationId, string navigationName, string linkUrl, int sortCount, bool isTarget, bool isShow)
        {
            Entity.m_WebSiteNavigation model = new Entity.m_WebSiteNavigation();
            model.NavigationId   = navigationId;
            model.IsShow         = isShow;
            model.IsTarget       = isTarget;
            model.LinkUrl        = linkUrl;
            model.NavigationName = navigationName;
            model.SortCount      = sortCount;
            CommonRepository repository = new CommonRepository();

            return(repository.Update(model));
        }
Example #9
0
        public bool AddNavigation(string navigationName, string linkUrl, int sortCount, bool isTarget, bool isShow)
        {
            Entity.m_WebSiteNavigation model = new Entity.m_WebSiteNavigation();
            model.AppendTime     = DateTime.Now;
            model.IsShow         = isShow;
            model.IsTarget       = isTarget;
            model.LinkUrl        = linkUrl;
            model.NavigationName = navigationName;
            model.SortCount      = sortCount;
            CommonRepository repository = new CommonRepository();

            return(repository.Add(model));
        }
        InterviewPanelViewModel InitSearch(InterviewPanelViewModel obj)
        {
            obj.ListDeptName        = CommonRepository.FillDepartmentList();
            obj.ListDesignationName = CommonRepository.FillDropdownDefaultValueSelect();
            obj.ListLevel           = CommonRepository.FillMasterDropDownList("InterviewLevel");
            //obj.ListTechnology = CommonRepository.FillMasterDropDownList("PrimarySkills");
            //obj.ListSecondarySkills = _objEmployeeService.GetSkillTypesCategory();
            obj.ListBusinessVertical = CommonRepository.FillMasterDropDownList("Business Vertical");

            obj.ListTechnology      = _objIInterviewPanelService.GetEmployeeSkillLinked("EP", "0");
            obj.ListSecondarySkills = _objIInterviewPanelService.GetEmployeeSkillLinked("SS_IP", "0");
            return(obj);
        }
Example #11
0
    public async Task <int> InsertAttendances(IImmutableList <CheckInsUpdate> checkInsUpdates)
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var guests           = checkInsUpdates.Where(predicate: c => c.PeopleId == null).ToImmutableList();
        var guestInsertCount = await InsertGuests(guests : guests, db : db).ConfigureAwait(continueOnCapturedContext: false);

        var regularPreCheckIns = checkInsUpdates.Except(second: guests).ToImmutableList();
        var regularInsertCount = await InsertRegularsAndVolunteers(regularPreCheckIns : regularPreCheckIns, db : db)
                                 .ConfigureAwait(continueOnCapturedContext: false);

        return(guestInsertCount + regularInsertCount);
    }
Example #12
0
    public async Task <int> UpdateKids(
        IImmutableList <PeopleUpdate> kids,
        IImmutableList <BackgroundTasks.Adult.Family> families
        )
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var existingKids = await CommonRepository.GetKidsByPeopleIds(db : db,
                                                                     peopleIds : kids.Select(selector : p => p.PeopleId !.Value)
                                                                     .ToImmutableList()).ConfigureAwait(continueOnCapturedContext : false);

        return(await UpdateKids(db : db, people : existingKids, updates : kids, families : families)
               .ConfigureAwait(continueOnCapturedContext: false));
    }
Example #13
0
    public async Task <IImmutableList <BackgroundTasks.Adult.Family> > InsertFamilies(
        IImmutableList <long> newHouseholdIds,
        IImmutableList <PeopleUpdate> peoples
        )
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var families = newHouseholdIds.Select(selector: h => MapFamily(householdId: h, peoples: peoples));
        await db.AddRangeAsync(entities : families).ConfigureAwait(continueOnCapturedContext: false);

        await db.SaveChangesAsync().ConfigureAwait(continueOnCapturedContext: false);

        return(await GetExistingFamilies(householdIds : newHouseholdIds).ConfigureAwait(continueOnCapturedContext: false));
    }
Example #14
0
        /// <summary>
        /// 更新帖子频道
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="channelName"></param>
        /// <param name="remarks"></param>
        /// <param name="isManager"></param>
        /// <param name="isShow"></param>
        /// <param name="sortCount"></param>
        /// <returns></returns>
        public bool UpdateChannel(int channelId, string channelName, string remarks, bool isManager, bool isShow, int sortCount)
        {
            Entity.m_PostsChannel model = new Entity.m_PostsChannel();
            model.AppendTime  = DateTime.Now;
            model.IsShow      = isShow;
            model.IsManager   = isManager;
            model.Remarks     = remarks;
            model.ChannelName = channelName;
            model.SortCount   = sortCount;
            model.ChannelId   = channelId;
            CommonRepository repository = new CommonRepository();

            return(repository.Update(model));
        }
Example #15
0
        public bool Add(string roleName)
        {
            bool Result = false;

            if (!string.IsNullOrEmpty(roleName))
            {
                Entity.m_ManagerRole model = new Entity.m_ManagerRole();
                model.RoleName = roleName;

                CommonRepository repository = new CommonRepository();
                return(repository.Add(model));
            }
            return(Result);
        }
        private bool EditContact(PeopleModels.NewContact Model)
        {
            int siteCoID = siteusercompanyid;

            CommonRepository   repo    = new CommonRepository();
            CoContactCompanies company = null;

            if (!string.IsNullOrWhiteSpace(Model.Company))
            {
                company = repo.AddCompany(siteCoID, Model.Company);
            }
            if (company == null)
            {
                company = new CoContactCompanies()
                {
                    ContactCoID = 0
                };
            }

            CoContacts contact = db.CoContacts
                                 .Include(p => p.CoContactAddresses)
                                 .Include(p => p.CoContactEmails)
                                 .Where(p => p.ContactID == Model.ContactID).FirstOrDefault();

            contact.ContactID        = Model.ContactID ?? 0;
            contact.SiteCoID         = siteCoID;
            contact.ContactTypeID    = Model.TypeID ?? 0;
            contact.ContactStatusID  = Model.StatusID;
            contact.ContactFirstName = Model.First;
            contact.ContactLastName  = Model.Last;
            contact.ContactCoID      = company.ContactCoID;
            contact.ModifiedDate     = DateTime.Now;
            contact.ContactManager   = Model.OwnerID;
            db.SaveChanges();

            repo.UpdatePhone(Model.ContactID ?? 0, (int)EnumWrapper.PhoneTypes.Mobile, Model.Mobile, true);
            repo.UpdatePhone(Model.ContactID ?? 0, (int)EnumWrapper.PhoneTypes.Phone, Model.Phone, true);
            repo.UpdateEmail(Model.ContactID ?? 0, Model.Email, true);
            repo.UpdateAddress(Model.ContactID ?? 0, new CoContactAddresses()
            {
                Address1  = Model.Address1,
                Address2  = Model.Address2,
                City      = Model.City,
                State     = Model.State,
                Zip       = Model.Zip,
                CountryID = Model.CountryID
            });
            return(true);
        }
Example #17
0
 public TrainingCourseViewModel(string trainingNameId, string trainingName, string trainingTypeId)
 {
     this.TrainingTypeDetails     = new SelectList(CommonRepository.GetMasterCategoryList(CommonConstants.TrainingType, true, new string[] { }).Where(x => x.Text == "Technical" || x.Text == "Soft Skill" || x.Text == "Select").ToList(), "Value", "Text");
     this.TrainingNameDetails     = new SelectList(CommonRepository.GetListWithDefault(trainingName, trainingNameId, true), "Value", "Text", "Selected");
     this.PaymentModeDetails      = new SelectList(CommonRepository.GetMasterCategoryList(CommonConstants.PaymentMode, true, new string[] { }).ToList(), "Value", "Text");
     this.TrainingModeDetails     = new SelectList(CommonRepository.GetMasterCategoryList(CommonConstants.TrainingMode, false, new string[] { }).ToList(), "Value", "Text");
     this.PaymentMadeDetails      = new SelectList(CommonRepository.GetMasterCategoryList(CommonConstants.PaymentMade, false, new string[] { }).ToList(), "Value", "Text");
     this.NominationDetails       = new SelectList(CommonRepository.GetMasterCategoryList(CommonConstants.NominationType, false, new string[] { }).ToList(), "Value", "Text");
     this.VendorDetails           = CommonRepository.FillMasterVendorList();
     this.AllEffectivenessDetails = CommonRepository.GetMasterTrainingEffectivenessDetails();
     this.SelectedEffectiveness   = new List <Effectiveness>();
     this.RaiseRequestDetails     = new RaiseRequestViewModel();
     this.objCommonModel          = CommonRepository.FillPopUpEmployeeList("");
     this.EmployeeDetails         = new SelectList(CommonRepository.GetEmployeeNameList(true, "0"), "Value", "Text");
 }
Example #18
0
        public ActionResult UpdateAttenance(int id)
        {
            AttenanceModel   am    = new AttenanceModel();
            CommonRepository _repo = new CommonRepository();
            var at = _repo.GetAttenancedate(id);

            am.Id = at.Id;
            am.sAttendanceDate = Convert.ToDateTime(at.AttendanceDate).ToString("dd/MM/yyyy");
            am.EmployeeId      = at.EmployeeId;
            am.sInTime         = Convert.ToDateTime(DateTime.Now.Date + at.InTime).ToString("hh:mm tt");
            am.sOutTime        = Convert.ToDateTime(DateTime.Now.Date + at.OutTime).ToString("hh:mm tt");
            am.PunchRecords    = at.PunchRecords;
            ViewBag.date       = am.sAttendanceDate;
            return(View(am));
        }
Example #19
0
    public async Task <int> SetFamilyUpdateDate(IImmutableList <BackgroundTasks.Adult.Family> families)
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var persistedFamilies = await db.Families
                                .Where(predicate : f => families.Select(e => e.FamilyId).Contains(f.Id))
                                .ToListAsync()
                                .ConfigureAwait(continueOnCapturedContext: false);

        var updateDate = DateTime.UtcNow;

        persistedFamilies.ForEach(action: f => f.UpdateDate = updateDate);

        return(await db.SaveChangesAsync());
    }
Example #20
0
        protected override Task ProcessInScope(IServiceProvider serviceProvider)
        {
            using (var scope = _serviceScopeFactory.CreateScope())
            {
                var limsDbContext       = scope.ServiceProvider.GetService <LimsDbContext>();
                var coreDbContext       = scope.ServiceProvider.GetService <CoreDbContext>();
                var commonRep           = new CommonRepository(coreDbContext, null, null);
                var dataService         = new CommonDataService(commonRep, null);
                var limsRep             = new LimsRepository(null, null, limsDbContext, null);
                var limsExchangeService = new LimsExchangeService(limsRep, dataService, null, null, null, null, null, null);

                Task.WaitAll(limsExchangeService.UpdateLimsRp());
            }
            return(Task.CompletedTask);
        }
Example #21
0
 public void Createitems(Author author, Book book, Category cateory)
 {
     using (var repository = new CommonRepository <Book>())
     {
         repository.Create(book);
     }
     using (var repository = new CommonRepository <Author>())
     {
         repository.Create(author);
     }
     using (var repository = new CommonRepository <Category>())
     {
         repository.Create(cateory);
     }
 }
    public async Task LogSearch(
        PeopleSearchParameters request,
        IImmutableList <Kid> people,
        string deviceGuid,
        CheckType checkType,
        bool filterLocations
        )
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var securityCode = request.SecurityCode;
        var searchLog    = new SearchLog
        {
            SearchDate           = DateTime.UtcNow,
            SecurityCode         = securityCode.Length > 10 ? securityCode[..10] : securityCode,
Example #23
0
    public async Task <bool> UpdateLocationAndCheckIn(int attendanceId, int locationId)
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var attendance = (await GetAttendances(attendanceIds: ImmutableList.Create(attendanceId), db: db)
                          .ConfigureAwait(continueOnCapturedContext: false))
                         .Single();

        attendance.LocationId  = locationId;
        attendance.CheckInDate = DateTime.UtcNow;

        var result = await db.SaveChangesAsync();

        return(result > 0);
    }
Example #24
0
    public async Task <int> AutoCheckoutEveryoneByEndOfDay()
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var attendances = await db.Attendances
                          .Where(predicate : a =>
                                 a.CheckInDate != null &&
                                 a.CheckOutDate == null &&
                                 a.CheckInDate < DateTime.Today)
                          .ToListAsync().ConfigureAwait(continueOnCapturedContext: false);

        attendances.ForEach(action: v
                            => v.CheckOutDate = v.CheckInDate !.Value.Date.AddDays(value: 1).AddSeconds(value: -1));
        return(await db.SaveChangesAsync().ConfigureAwait(continueOnCapturedContext: false));
    }
Example #25
0
        public List <SystemRole> GetUserRoles(long userId)
        {
            List <SystemRole> result = null;

            CommonRepository.UseDbContext(dbContext =>
            {
                result = (from r in dbContext.Set <SystemRole>()
                          from ru in dbContext.Set <RoleUser>()
                          where ru.UserId == userId &&
                          ru.RoleId == r.RecordId
                          select r).ToList();
            });

            return(result);
        }
Example #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        long collectionId = 0;
        string homeServices = "HomeServices", homeBanners = "HomeBanners";
        if (id > 0)
        {
            if (contentData != null)
            {
                CommonRepository common = new CommonRepository();

                //To bind the service module
                llServicesTitle.Text = homeProperties.serviceTitle;
                collectionId = homeProperties.serviceCollectionId;
                string serviceResult = string.Empty;
                if (HttpContext.Current.Cache[homeServices] == null)
                {
                    serviceResult = collectionId > 0 ? common.GetServices(collectionId) : string.Empty;
                    HttpContext.Current.Cache.Insert(homeServices, serviceResult, null, DateTime.Now.AddMinutes("CacheDuration".GetAppKeyDouble()), TimeSpan.Zero);
                }
                else
                    serviceResult = HttpContext.Current.Cache[homeServices].ToString();
                llServicesInfo.Text = serviceResult;

                //To bind the our clients
                string xmlString = clientContentView.Model.ContentList.FirstOrDefault().Html;
                if (!string.IsNullOrEmpty(xmlString))
                {
                    this.xmlDataSource.Data = xmlString;
                    this.xmlDataSource.DataBind();
                    repOurClients.DataSource = xmlDataSource;
                    repOurClients.DataBind();
                }

                //To bind the banner
                List<HomeBanner> bannerList;
                if (HttpContext.Current.Cache[homeBanners] == null)
                {
                    bannerList = homeUtils.GetBanners(contentData.Html);
                    if (bannerList != null)
                        HttpContext.Current.Cache.Insert(homeBanners, bannerList, null, DateTime.Now.AddMinutes("CacheDuration".GetAppKeyDouble()), TimeSpan.Zero);
                }
                else
                    bannerList = (List<HomeBanner>)HttpContext.Current.Cache[homeBanners];
                //repHomeBanner.DataSource = bannerList != null ? bannerList : null;
                //repHomeBanner.DataBind();
            }
        }
    }
    public async Task <IImmutableList <KidsTown.Models.Location> > GetLocations(
        long eventId,
        IImmutableList <int>?selectedLocationGroups
        )
    {
        await using var db = CommonRepository.GetDatabase(serviceScopeFactory: _serviceScopeFactory);

        var locations = await db.Locations
                        .Where(predicate : l => l.EventId == eventId &&
                               (selectedLocationGroups == null || selectedLocationGroups.Contains(l.LocationGroupId)))
                        .ToListAsync()
                        .ConfigureAwait(continueOnCapturedContext: false);

        return(locations.Select(selector: MapLocation)
               .ToImmutableList());
    }
Example #28
0
        public ActionResult GetCity(int stateId)
        {
            List <SelectListItem> citynames = new List <SelectListItem>();

            if (stateId > 0)
            {
                List <QTrans.Models.ViewModel.Common.StateCity> city = new CommonRepository().GetCityByStateId(stateId).Response.Where(x => x.StateId == stateId).ToList();
                city.ForEach(x =>
                {
                    citynames.Add(new SelectListItem {
                        Text = x.CityName, Value = x.CityId.ToString()
                    });
                });
            }
            return(Json(citynames, JsonRequestBehavior.AllowGet));
        }
Example #29
0
        public CurrencyModel Currency(string locale)
        {
            CurrencyModel currency = new CurrencyModel();

            try
            {
                Website.Instance.logger.Info($"WMS Currency Start! B2D locale:{locale}");

                currency = CommonRepository.GetCurrency(locale);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(currency);
        }
Example #30
0
        private void LoadState()
        {
            CommonRepository repository = new CommonRepository();

            foreach (var item in repository.GetState().Response)
            {
                if (this.StateStorage.Keys.Contains(item.StateId))
                {
                    this.StateStorage.AddOrUpdate(item.StateId, item, (key, oldValue) => item);
                }
                else
                {
                    this.StateStorage.TryAdd(item.StateId, item);
                }
            }
        }
Example #31
0
        public bool Add(int roleId, string adminName, string password)
        {
            bool Result = false;

            if (!string.IsNullOrEmpty(adminName) && !string.IsNullOrEmpty(password))
            {
                Entity.m_ManagerAccount model = new Entity.m_ManagerAccount();
                model.AdminName = adminName;
                model.Password  = Framework.Core.TextHelper.MD5Encrypt(password);
                model.RoleId    = roleId;
                model.IsStatus  = true;
                CommonRepository repository = new CommonRepository();
                return(repository.Add(model));
            }
            return(Result);
        }
Example #32
0
        public ActionResult UpdateAttenance(AttenanceModel am)
        {
            if (ModelState.IsValid)
            {
                am.InTime  = DateTime.ParseExact(am.sInTime, "hh:mm tt", CultureInfo.InvariantCulture).TimeOfDay;
                am.OutTime = DateTime.ParseExact(am.sOutTime, "hh:mm tt", CultureInfo.InvariantCulture).TimeOfDay;
                CommonRepository _repo = new CommonRepository();
                _repo.UpdateAttenance(am);
            }
            else
            {
                return(View(am));
            }

            return(RedirectToAction("AttenanceReport", new { Date = Convert.ToDateTime(am.sAttendanceDate).ToString("dd/MM/yyyy") }));
        }
Example #33
0
        private string CreateWebFrobIfNecessary(out bool authenticated)
        {
            IRepositoryBase repositoryBase = new CommonRepository(elementProxy);

            // if it is a redirect by flickr then take the frob from url.
            if (!string.IsNullOrEmpty(HttpContext.Current.Request["frob"]))
            {
                authenticated = false;
                return(HttpContext.Current.Request["frob"]);
            }
            else
            {
                authenticated = true;
                return(repositoryBase.GetFrob());
            }
        }
Example #34
0
        public ActionResult UpdateEmployee(int EMPID)
        {
            EmployeeViewModel e = new EmployeeViewModel();

            EmployeeRepository er = new EmployeeRepository();

            e = er.GetEmployee(EMPID);

            CommonRepository _repo = new CommonRepository();

            ViewBag.ListDepartment  = _repo.ListDepartment();
            ViewBag.ListDesignation = _repo.ListDesignation();
            ViewBag.ListUNIT        = _repo.ListUNIT();
            ViewBag.ListWAGESTYPE   = _repo.ListWAGESTYPE();

            ViewBag.ListGENDER = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = Gender.Male.ToString(), Value = Gender.Male.ToString()
                },
                new SelectListItem {
                    Text = Gender.FeMale.ToString(), Value = Gender.FeMale.ToString()
                }
            };

            ViewBag.ListMARITALSTATUS = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = MARITALSTATUS.Single.ToString(), Value = MARITALSTATUS.Single.ToString()
                },
                new SelectListItem {
                    Text = MARITALSTATUS.Married.ToString(), Value = MARITALSTATUS.Married.ToString()
                }
            };

            ViewBag.ListMode = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = Mode.ACTUAL.ToString(), Value = Mode.ACTUAL.ToString()
                },
                new SelectListItem {
                    Text = Mode.ADUITING.ToString(), Value = Mode.ADUITING.ToString()
                }
            };

            return(View(e));
        }
Example #35
0
        public HttpResponseMessage GetLocations(long id, [FromUri]string groupBy)
        {
            if (id <= 0)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            if (string.IsNullOrEmpty(groupBy) || !string.Equals(groupBy, "emp", StringComparison.OrdinalIgnoreCase))
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            List<Location> locations = null;
            JoinTableRepository<EmployeeModel, SkillsetModel> repository = new JoinTableRepository<EmployeeModel, SkillsetModel>();
            IEnumerable<EmployeeModel> employees = repository.GetLeft(id);
            IEnumerable<string> employeeIds = employees.Select(x => x.EmpId);
            if (!employeeIds.IsNullOrEmpty())
            {
                CommonRepository<MToMTableModel<EmployeeModel, LocationModel>> repositoryEmpLoc = new CommonRepository<MToMTableModel<EmployeeModel, LocationModel>>();
                var op = repositoryEmpLoc.GetBySpecification(new Specification<MToMTableModel<EmployeeModel, LocationModel>>(x => x.LeftItem.IsActive == true && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId)));
                var tbl = from t1 in op
                          group t1 by t1.RightItem into newGroup
                          select new { Loc = newGroup.Key, EmpCount = newGroup.Count() };
                locations = new List<Location>();
                foreach (var item in tbl)
                {
                    Location loc = AutoMapper.Map<LocationModel, Location>(item.Loc);
                    loc.ExtendedProperties = new Dictionary<string, string>()
                    {
                        { "emp-count", item.EmpCount.ToString()} // string.Join(",", item.Select(x => x.LeftItem.EmpId)) }
                    };

                    locations.Add(loc);
                }
            }

            IEnumerable<Location> target = locations; // AutoMapper.MapCollection<LocationModel, Location>(locations);
            if (target.IsNullOrEmpty())
            {
                return Request.CreateResponse(HttpStatusCode.NotFound);
            }

            Response<IEnumerable<Location>> results = new Response<IEnumerable<Location>>(target);
            return Request.CreateResponse(HttpStatusCode.OK, results);
        }
Example #36
0
    protected override void OnInit(EventArgs e)
    {
        LandingRepository landingRepository = new LandingRepository();
        landingPage = landingRepository.GetLandingPage(GeneralExtensions.GetQueryStringId());

        CommonRepository commonRepository = new CommonRepository();
        UserExtensions userExtensions = new UserExtensions();

        if (userExtensions.IsUserLoggedIn() && System.Web.HttpContext.Current.Request.RawUrl.Contains("resources"))
        {
            ltlServices.Text = commonRepository.GetServices("MemberResourcesCollectionId".GetAppKeyLong());
        }
        else
        {
            ltlServices.Text = commonRepository.GetServices(landingPage.ServicesCollectioId.ConvertToLong());

        }
    }
        public static SelectList GetStatus(long? StatusID)
        {
            CommonRepository modelRepo = new CommonRepository();
            var status = modelRepo.ReadAllStatus();

            List<SelectListItem> _ListStatus = new List<SelectListItem>();

                foreach (var item in status)
                {
                    SelectListItem itr = new SelectListItem();
                    itr.Text = item.StatusName;
                    itr.Value = item.StatusID.ToString();
                    itr.Selected = false;

                    _ListStatus.Add(itr);
                }

            return new SelectList(_ListStatus, "Value", "Text", StatusID);
        }
        public static SelectList GetTitle(long? TitleID)
        {
            CommonRepository modelRepo = new CommonRepository();
            var status = modelRepo.ReadAllTitles();

            List<SelectListItem> _ListTitle = new List<SelectListItem>();

                foreach (var item in status)
                {
                    SelectListItem itr = new SelectListItem();
                    itr.Text = item.TitleName;
                    itr.Value = item.TitleID.ToString();
                    itr.Selected = false;

                    _ListTitle.Add(itr);
                }

            return new SelectList(_ListTitle, "Value", "Text", TitleID);
        }
        public JsonResult GetTypeSalutation()
        {
            CommonRepository modelRepo = new CommonRepository();
            // var status = modelRepo.ReadAllStatus();

            return Json(modelRepo.ReadAllTitles().OrderBy(o => o.TitleName).Select(c => new { TitleID = c.TitleID, TitleName = c.TitleName }).OrderBy(o => o.TitleName), JsonRequestBehavior.AllowGet);
            //return Json(modelRepo.ReadAllTitles(), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetTypeStatus()
        {
            CommonRepository modelRepo = new CommonRepository();
            // var status = modelRepo.ReadAllStatus();

            //  return Json(modelRepo.ReadAllStatus().OrderBy(o => o.Name).Select(c => new { StatusID = c.ID, StatusName = c.Name }).OrderBy(o => o.TravellerID), JsonRequestBehavior.AllowGet);
            return Json(modelRepo.ReadAllStatus(), JsonRequestBehavior.AllowGet);
        }
Example #41
0
        public HttpResponseMessage GetEmployeeBySkills(long id, [FromUri]long[] skill = null, [FromUri] string flag = "none")
        {
            if (id <= 0)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            List<EmployeeLite> result = null;
            result = new List<EmployeeLite>();
            JoinTableRepository<EmployeeModel, LocationModel> repository = new JoinTableRepository<EmployeeModel, LocationModel>();
            IEnumerable<string> employeeIds = repository.GetLeft(id).Select(x => x.EmpId).ToList();
            CommonRepository<MToMTableModel<EmployeeModel, SkillsetModel>> repositoryEmpSkills = new CommonRepository<MToMTableModel<EmployeeModel, SkillsetModel>>();
            CommonRepository<MToMVersionableTableModel<EmployeeModel, ProjectModel>> repositoryEmpProjects = new CommonRepository<MToMVersionableTableModel<EmployeeModel, ProjectModel>>();
            if (skill.IsNullOrEmpty())
            {
                skill = repositoryEmpSkills.GetBySpecification(new Specification<MToMTableModel<EmployeeModel, SkillsetModel>>(x => x.LeftItem.IsActive == true && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId))).Select(x => x.RightItem.Id).Distinct().ToArray();
            }

            if (skill.IsNullOrEmpty())
            {
                return Request.CreateResponse(HttpStatusCode.NotFound);
            }

            foreach (long skillsetId in skill.Distinct())
            {
                IEnumerable<EmployeeModel> skillEmps = repositoryEmpSkills.GetBySpecification(new Specification<MToMTableModel<EmployeeModel, SkillsetModel>>(x => x.LeftItem.IsActive == true && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId) && skillsetId == x.RightItem.Id)).Select(x => x.LeftItem).ToList();
                if (!skillEmps.IsNullOrEmpty())
                {
                    switch (flag)
                    {
                        case "billed":
                            employeeIds = skillEmps.Select(x => x.EmpId).ToList();
                            var skillProjEmps = repositoryEmpProjects.GetBySpecification(new Specification<MToMVersionableTableModel<EmployeeModel, ProjectModel>>(x => x.LeftItem.IsActive == true
                                                   && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId))).Select(x => x.LeftItem).ToList();
                            // total skilled employees billable
                            result = ConstructEmployeeLiteList(skillProjEmps);
                            break;
                        case "unbilled":
                            employeeIds = skillEmps.Select(x => x.EmpId).ToList();
                            var skillProjEmpIds = repositoryEmpProjects.GetBySpecification(new Specification<MToMVersionableTableModel<EmployeeModel, ProjectModel>>(x => x.LeftItem.IsActive == true
                                                   && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId))).Select(x => x.LeftItem.EmpId).ToList();
                            var skillNonProjEmps = skillEmps.Where(x => !skillProjEmpIds.Contains(x.EmpId)).ToList();
                            // total skilled employees non billable
                            result = ConstructEmployeeLiteList(skillNonProjEmps);
                            break;
                        default:
                            // total skilled employees in location
                            result = ConstructEmployeeLiteList(skillEmps);
                            break;
                    }
                }
            }

            if (result.IsNullOrEmpty())
            {
                return Request.CreateResponse(HttpStatusCode.NotFound);
            }

            Response<List<EmployeeLite>> results = new Response<List<EmployeeLite>>(result);
            return Request.CreateResponse(HttpStatusCode.OK, results);
        }
Example #42
0
        public HttpResponseMessage GetEmployeeUtilization(long id, [FromUri]long[] skill = null)
        {
            if (id <= 0)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            CustomData result = null;
            result = new CustomData();
            JoinTableRepository<EmployeeModel, LocationModel> repository = new JoinTableRepository<EmployeeModel, LocationModel>();
            IEnumerable<string> employeeIds = repository.GetLeft(id).Select(x => x.EmpId).ToList();
            CommonRepository<MToMTableModel<EmployeeModel, SkillsetModel>> repositoryEmpSkills = new CommonRepository<MToMTableModel<EmployeeModel, SkillsetModel>>();
            CommonRepository<MToMVersionableTableModel<EmployeeModel, ProjectModel>> repositoryEmpProjects = new CommonRepository<MToMVersionableTableModel<EmployeeModel, ProjectModel>>();
            if (skill.IsNullOrEmpty())
            {
                skill = repositoryEmpSkills.GetBySpecification(new Specification<MToMTableModel<EmployeeModel, SkillsetModel>>(x => x.LeftItem.IsActive == true && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId))).Select(x => x.RightItem.Id).Distinct().ToArray();
            }

            if (skill.IsNullOrEmpty())
            {
                return Request.CreateResponse(HttpStatusCode.NotFound);
            }

            foreach (long skillsetId in skill.Distinct())
            {
                // total skilled employees in location
                var skillEmpIds = repositoryEmpSkills.GetBySpecification(new Specification<MToMTableModel<EmployeeModel, SkillsetModel>>(x => x.LeftItem.IsActive == true && x.RightItem.IsActive == true && employeeIds.Contains(x.LeftItem.EmpId) && skillsetId == x.RightItem.Id)).Select(x => x.LeftItem.EmpId).ToList();
                int locSkillEmpCount = skillEmpIds.Count();
                if (locSkillEmpCount > 0)
                {
                    var skillProjEmpCount = repositoryEmpProjects.GetBySpecification(new Specification<MToMVersionableTableModel<EmployeeModel, ProjectModel>>(x => x.LeftItem.IsActive == true
                        && x.RightItem.IsActive == true && skillEmpIds.Contains(x.LeftItem.EmpId))).Count();
                    result.ExtendedProperties[skillsetId.ToString()] = locSkillEmpCount.ToString() + "," + skillProjEmpCount.ToString();
                }
                else
                {
                    result.ExtendedProperties[skillsetId.ToString()] = locSkillEmpCount.ToString() + "," + 0.ToString();
                }
            }

            Response<CustomData> results = new Response<CustomData>(result);
            return Request.CreateResponse(HttpStatusCode.OK, results);
        }