Esempio n. 1
0
        public FindUserDetailsResponse FindUserDetails(FindUserDetailsRequest request)
        {
            IClaimsIdentity identity = (IClaimsIdentity)Thread.CurrentPrincipal.Identity;
            string          upn      = identity.Claims.FindAll(c => { return(c.ClaimType == ClaimTypes.Upn); }).First().Value;

            AuthenticationActions.FindUserDetailsAction action = PolicyInjection.Create <AuthenticationActions.FindUserDetailsAction>();

            AuthenticationEntities.FindUserDetailsParameters parameters = Translators.FindUserDetailsTranslator.TranslateFromServiceToBusiness(request.FindUserDetailsParameters);

            parameters.UserPrincipalIdentity = upn; /* user@domain */
            parameters.UserIdentity          = upn.Split('@')[0];

            AuthenticationEntities.FindUserDetailsResult r = action.Execute(parameters);

            FindUserDetailsResponse response = new FindUserDetailsResponse();

            response.FindUserDetailsResult = GenericMapper.MapNew <DataContracts.FindUserDetailsResult>(r);

            response.FindUserDetailsResult.UserWarehouses = GenericMapper.MapListNew <DataContracts.UserWarehouseCollection, AuthenticationEntities.FindUserWarehousesResult, DataContracts.UserWarehouse>(
                r.Warehouses, Translators.FindUserDetailsTranslator.TranslateFromBusinessToService);

            response.FindUserDetailsResult.UserCompanies = GenericMapper.MapListNew <DataContracts.UserCompanyCollection, AuthenticationEntities.FindUserCompaniesResult, DataContracts.UserCompany>(
                r.Companies, Translators.FindUserDetailsTranslator.TranslateFromBusinessToService);

            return(response);
        }
        /// <summary>
        /// Gets the delivery route details for Pdf Generation.
        /// </summary>
        /// <param name="routeId">The delivery route identifier.</param>
        /// <param name="unitGuid">The unit unique identifier.</param>
        /// <returns>DeliveryRouteDTO</returns>
        public async Task <RouteDTO> GetRouteSummary(Guid routeId)
        {
            if (routeId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(routeId));
            }

            using (loggingHelper.RMTraceManager.StartTrace("Business.GetDeliveryRouteDetailsforPdfGeneration"))
            {
                string methodName = typeof(DeliveryRouteBusinessService) + "." + nameof(GetRouteSummary);
                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodEntryEventId);

                List <string> categoryNames = new List <string>
                {
                    ReferenceDataCategoryNames.DeliveryPointUseIndicator,
                    ReferenceDataCategoryNames.OperationalObjectType,
                    ReferenceDataCategoryNames.DeliveryRouteMethodType,
                    ReferenceDataCategoryNames.RouteActivityType
                };

                var referenceDataCategoryList = deliveryRouteIntegrationService.GetReferenceDataSimpleLists(categoryNames).Result;

                var routeDetails = await deliveryRouteDataService.GetRouteSummary(routeId, referenceDataCategoryList);

                RouteDTO route = GenericMapper.Map <RouteDataDTO, RouteDTO>(routeDetails);

                loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodExitEventId);

                return(route);
            }
        }
Esempio n. 3
0
        public void SaveMainRow()
        {
            Loading = true;
            var saveTemp = (TblTradeAgreementTransaction) new TblTradeAgreementTransaction().InjectFrom(SelectedMainRow);

            saveTemp.TblTradeAgreementHeaders = new ObservableCollection <TblTradeAgreementHeader>();
            var details = SelectedMainRow.DetailsList.Where(d => d.TblVendorPurchaseGroup != null &&
                                                            d.ItemCode != null && d.CurrencyCode != null);

            foreach (var item in details.GroupBy(d => new { d.Vendor }))
            {
                var firstDetail          = item.FirstOrDefault();
                var TradeAgreementHeader = new TblTradeAgreementHeader()
                {
                    FromDate = SelectedMainRow.FromDate,
                    ToDate   = SelectedMainRow.ToDate,
                    Vendor   = item.Key.Vendor,
                    TblTradeAgreementTransaction = saveTemp.Iserial,
                };
                if (firstDetail != null)
                {
                    TradeAgreementHeader.Iserial = firstDetail.HeaderIserial;
                }

                TradeAgreementHeader.TblTradeAgreementDetails =
                    new ObservableCollection <TblTradeAgreementDetail>();
                GenericMapper.InjectFromObCollection(TradeAgreementHeader.TblTradeAgreementDetails,
                                                     details.Where(d => d.Vendor == item.Key.Vendor));

                saveTemp.TblTradeAgreementHeaders.Add(TradeAgreementHeader);
            }
            productionServiceClient.SaveTradeAgreementAsync(saveTemp);
        }
Esempio n. 4
0
        /// <summary>
        /// Fetch the Route log status.
        /// </summary>
        /// <returns>List</returns>
        public List <ReferenceDataDTO> RouteLogStatus()
        {
            using (loggingHelper.RMTraceManager.StartTrace("DataService.RouteLogStatus"))
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ReferenceDataAPIPriority, LoggerTraceConstants.ReferenceDataCategoryDataServiceMethodEntryEventId, LoggerTraceConstants.Title);

                try
                {
                    List <ReferenceDataDTO> lstReferenceDt = new List <ReferenceDataDTO>();
                    string categoryname = "Delivery Point Operational Status";
                    var    query        = DataContext.ReferenceDataCategories.AsNoTracking().Include(m => m.ReferenceDatas).Where(n => n.CategoryName.Trim().Equals(categoryname, StringComparison.OrdinalIgnoreCase)).SingleOrDefault();
                    if (query?.ReferenceDatas != null && query.ReferenceDatas.Count > 0)
                    {
                        lstReferenceDt = GenericMapper.MapList <ReferenceData, ReferenceDataDTO>(query.ReferenceDatas.ToList());
                    }

                    loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ReferenceDataAPIPriority, LoggerTraceConstants.ReferenceDataCategoryDataServiceMethodExitEventId, LoggerTraceConstants.Title);
                    return(lstReferenceDt);
                }
                catch (InvalidOperationException ex)
                {
                    ex.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default);
                    throw new SystemException(ErrorConstants.Err_InvalidOperationExceptionForSingleorDefault, ex);
                }
            }
        }
Esempio n. 5
0
        public IActionResult GetAll()
        {
            var users          = _userService.GetAll();
            var userViewModels = GenericMapper.MapListOfObjects <FullUserViewModel>(users);

            return(Ok(userViewModels));
        }
Esempio n. 6
0
        public void SaveHeader()
        {
            var dyeingPlanlist = new ObservableCollection <TblDyeingPlanACC>();

            foreach (var item in HeaderViewModel.DyeingViewModelList)
            {
                var dyeingplanrow = new TblDyeingPlanACC();
                dyeingplanrow.InjectFrom(item);
                dyeingplanrow.TblDyeingPlanDetailsAccs = new ObservableCollection <TblDyeingPlanDetailsAcc>();
                GenericMapper.InjectFromObCollection(dyeingplanrow.TblDyeingPlanDetailsAccs, item.DetailsViewModel);
                dyeingPlanlist.Add(dyeingplanrow);
            }

            var summaryList = new ObservableCollection <TblDyeingSummaryAcc>();

            GenericMapper.InjectFromObCollection(summaryList, DyeingSummeryViewModelList);
            foreach (var row in DyeingSummeryViewModelList)
            {
                var sumRow =
                    FabricStorageList.Where(
                        x => x.CONFIGID == row.ColorName && x.INVENTSITEID == row.Size && x.itemid == row.FabricCode).Sum(w => w.QuantityPerMeter);
                row.Valid = row.CalculatedTotalQty <= (double)sumRow.Value;
            }

            if (DyeingSummeryViewModelList.Count(x => x.Valid) != 0)
            {
                _webService.SaveDyeingHeaderListAccAsync(new TblDyeingPlanHeaderAcc().InjectFrom(HeaderViewModel) as TblDyeingPlanHeaderAcc
                                                         , dyeingPlanlist, summaryList);
            }
            else
            {
                MessageBox.Show("Some Of The Quantities Doesn't Exists In the Warehouse");
            }
        }
Esempio n. 7
0
        public IActionResult GetById(int id)
        {
            var user          = _userService.GetById(id);
            var userViewModel = GenericMapper.MapObject <FullUserViewModel>(user);

            return(Ok(userViewModel));
        }
        //takes UserRoleChoiceEnum as input and returns the appropriate user details
        public List <UserModel> GetUserDetails(UserRoleChoiceEnum role)
        {
            List <Models.UserModel> users = null;

            using (UserDbContext ctx = new UserDbContext())
            {
                switch (role)
                {
                case UserRoleChoiceEnum.Student:
                    users = ctx.Users.Where(user => user.IsStudent).ToList();
                    break;

                case UserRoleChoiceEnum.Other:
                    users = ctx.Users.Where(user => !user.IsStudent).ToList();
                    break;

                case UserRoleChoiceEnum.All:
                    users = ctx.Users.ToList();
                    break;
                }
            }
            return(users.ConvertAll(user =>
            {
                UserModel userModel = new UserModel();
                GenericMapper.Map(user, userModel);
                return userModel;
            }));
        }
        /// <summary>
        /// Fetch the  Route.
        /// </summary>
        /// <param name="operationStateId">Guid operationStateID</param>
        /// <param name="deliveryScenarioId">Guid deliveryScenarioID</param>
        /// <param name="userUnit">The user unit.</param>
        /// <returns>List</returns>
        public List <RouteDTO> FetchRoutes(Guid operationStateId, Guid deliveryScenarioId, Guid userUnit, string UnitName)
        {
            using (loggingHelper.RMTraceManager.StartTrace("DataService.FetchRoutes"))
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodEntryEventId, LoggerTraceConstants.Title);
                List <RouteDTO> routedetails = null;

                if (string.Equals(UserUnit.CollectionUnit.GetDescription(), UnitName.Trim(), StringComparison.OrdinalIgnoreCase))
                {
                    IEnumerable <CollectionRoute> result = DataContext.CollectionRoutes.AsNoTracking()
                                                           .Where(x => x.Scenario.Unit_GUID == userUnit && x.CollectionScenario_GUID == deliveryScenarioId &&
                                                                  x.Scenario.OperationalState_GUID == operationStateId).ToList();
                    routedetails = GenericMapper.MapList <CollectionRoute, RouteDTO>(result.ToList());
                }
                else
                {
                    IEnumerable <DeliveryRoute> result = DataContext.DeliveryRoutes.AsNoTracking()
                                                         .Where(x => x.Scenario.Unit_GUID == userUnit && x.DeliveryScenario_GUID == deliveryScenarioId &&
                                                                x.Scenario.OperationalState_GUID == operationStateId).ToList();
                    routedetails = GenericMapper.MapList <DeliveryRoute, RouteDTO>(result.ToList());
                }

                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodExitEventId, LoggerTraceConstants.Title);

                return(routedetails);
            }
        }
        private void componentCbx_SelectedIndexChanged(object sender, EventArgs e)
        {
            VisualComponentItem item = componentCbx.SelectedItem as VisualComponentItem;

            if (item.Instance == null)
            {
                item.Instance      = Activator.CreateInstance(item.Type) as UXComponent;
                item.Instance.Name = ViewHelper.GetDefaultComponentName(ComponentNames, item.Type);
                object[] attributes = item.Type.GetCustomAttributes(typeof(VisualDesignerAttribute), false);

                if (attributes != null)
                {
                    GenericMapper.Map((VisualDesignerAttribute)attributes[0], item.Instance);
                }
            }

            if (UXComponent != null)
            {
                GenericMapper.Map(UXComponent, item.Instance);
            }

            if (item.Instance is UXServiceComponent &&
                (serviceMethod != null ||
                 componentMap != null))
            {
                ((UXServiceComponent)item.Instance).ServiceMethod = serviceMethod;
                ((UXServiceComponent)item.Instance).ComponentMap  = componentMap;
            }

            UXComponent = item.Instance;

            propertyGrid.SelectedObject = UXComponent;

            EnableDisableButtons();
        }
Esempio n. 11
0
        /// <summary>
        /// Save block sequence in database
        /// </summary>
        /// <param name="blockSequenceDTO">blockSequenceDTO</param>
        /// <param name="deliveryRouteId">deliveryRouteId</param>
        /// <returns>bool</returns>
        public async Task <bool> AddBlockSequence(BlockSequenceDTO blockSequenceDTO, Guid deliveryRouteId)
        {
            bool isBlockSequencInserted = false;

            try
            {
                string methodName = MethodHelper.GetActualAsyncMethodName();
                using (loggingHelper.RMTraceManager.StartTrace(methodName))
                {
                    loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodEntryEventId, LoggerTraceConstants.Title);

                    var block_Guid = await(from dr in DataContext.DeliveryRouteBlocks.AsNoTracking()
                                           join b in DataContext.Blocks.AsNoTracking() on dr.Block_GUID equals b.ID
                                           where b.BlockType == UnSequenced && dr.DeliveryRoute_GUID == deliveryRouteId
                                           select b.ID).SingleOrDefaultAsync();

                    BlockSequence blockSequenceEntity = GenericMapper.Map <BlockSequenceDTO, BlockSequence>(blockSequenceDTO);
                    blockSequenceEntity.Block_GUID = block_Guid;
                    DataContext.BlockSequences.Add(blockSequenceEntity);
                    DataContext.SaveChanges();
                    isBlockSequencInserted = true;
                    loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodExitEventId, LoggerTraceConstants.Title);
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                throw new DbConcurrencyException(ErrorConstants.Err_Concurrency);
            }
            catch (DbUpdateException dbUpdateException)
            {
                throw new DataAccessException(dbUpdateException, string.Format(ErrorConstants.Err_SqlAddException, string.Concat("creating block sequence for selected delivery route")));
            }

            return(isBlockSequencInserted);
        }
Esempio n. 12
0
        public HttpResponseMessage Login([FromBody] LoginModel loginModel)
        {
            string         email    = loginModel.email;
            string         password = loginModel.password;
            CustomResponse response;
            User           loginUser = _repository.Login(loginModel);

            if (loginUser != null)
            {
                //LoginUser
                var userToken = new UserTokenDTO()
                {
                    email      = email,
                    password   = password,
                    expireDate = DateTime.Now.AddDays(TOKEN_EXPIRE_DAY)
                };

                //Serializing userToken
                var jsonString = JsonConvert.SerializeObject(userToken);
                // Token generation
                var token = FTH.Extension.Encrypter.Encrypt(jsonString, LoginUtility.PRIVATE_KEY);

                LoginResponseDTO userDTO = GenericMapper.MapToLoginResponseDTO(loginUser, token);

                response = ResponseMessageHelper.CreateResponse(HttpStatusCode.OK, false, userDTO, ConstantResponse.LOGIN_SUCCESS);
                return(Request.CreateResponse <CustomResponse>(HttpStatusCode.OK, response));
            }
            else
            {
                response = ResponseMessageHelper.CreateResponse(HttpStatusCode.Unauthorized, true, null, ConstantResponse.LOGIN_FAILED);
                return(Request.CreateResponse <CustomResponse>(HttpStatusCode.Unauthorized, response));
            }
        }
        /// <summary>
        /// Get filtered routes on basis of search text for Advance Search .
        /// </summary>
        /// <param name="searchText">Text to search</param>
        /// <param name="locationId">selected unit's location ID</param>
        /// <returns>Returns list of routes that matches the search text</returns>
        public async Task <List <RouteDTO> > GetRoutesForAdvanceSearch(string searchText, Guid locationId)
        {
            if (string.IsNullOrEmpty(searchText))
            {
                throw new ArgumentNullException(nameof(searchText));
            }

            if (locationId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(locationId));
            }

            using (loggingHelper.RMTraceManager.StartTrace("Business.GetRouteForAdvanceSearch"))
            {
                string methodName = typeof(DeliveryRouteBusinessService) + "." + nameof(GetRoutesForAdvanceSearch);
                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodEntryEventId);

                var routeDetails = await deliveryRouteDataService.GetRoutesForAdvanceSearch(searchText, locationId);

                List <RouteDTO> routes = GenericMapper.MapList <RouteDataDTO, RouteDTO>(routeDetails);

                loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodExitEventId);

                return(routes);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Add new address location to database.
        /// </summary>
        /// <param name="addressLocationDTO">AddressLocationDTO object</param>
        /// <returns>Task<int></returns>
        public async Task <int> SaveNewAddressLocation(AddressLocationDTO addressLocationDTO)
        {
            try
            {
                using (loggingHelper.RMTraceManager.StartTrace("DataService.SaveNewAddressLocation"))
                {
                    string method = MethodHelper.GetActualAsyncMethodName();
                    loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodEntryEventId, LoggerTraceConstants.Title);

                    var addressLocationEntity = new AddressLocation();

                    GenericMapper.Map(addressLocationDTO, addressLocationEntity);
                    DataContext.AddressLocations.Add(addressLocationEntity);
                    var saveNewAddressLocation = await DataContext.SaveChangesAsync();

                    loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodExitEventId, LoggerTraceConstants.Title);
                    return(saveNewAddressLocation);
                }
            }
            catch (DbUpdateException dbUpdateException)
            {
                throw new DataAccessException(dbUpdateException, string.Format(ErrorConstants.Err_SqlAddException, string.Concat("Address Location for UDPRN:", addressLocationDTO.UDPRN)));
            }
            catch (NotSupportedException notSupportedException)
            {
                notSupportedException.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default);
                throw new InfrastructureException(notSupportedException, ErrorConstants.Err_NotSupportedException);
            }
            catch (ObjectDisposedException disposedException)
            {
                disposedException.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default);
                throw new ServiceException(disposedException, ErrorConstants.Err_ObjectDisposedException);
            }
        }
Esempio n. 15
0
        public HttpResponseMessage AddBoat([FromBody] Boat boat)
        {
            //Gets the user from token
            var            token  = Request.Headers.Authorization.Parameter;
            User           sender = UserUtility.GetUserByToken(token);
            CustomResponse response;

            //Controls whether the user is leader or not
            if (sender.team == null || sender.team.leaderId != sender.id)
            {
                response = ResponseMessageHelper.CreateResponse(HttpStatusCode.Unauthorized, true, HttpStatusCode.Unauthorized, ConstantResponse.TEAM_BOAT_FAILED);
                return(Request.CreateResponse(HttpStatusCode.Unauthorized, response));
            }
            //Controls whether the users'team has already had a boat or not
            else if (sender.team.boat != null)
            {
                response = ResponseMessageHelper.CreateResponse(HttpStatusCode.BadRequest, true, HttpStatusCode.BadRequest, ConstantResponse.TEAM_BOAT_ALREADY_HAVE_BOAT);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, response));
            }

            //Adds the boat to the team
            Boat addedBoat = _repository.AddBoat(sender.id, boat);
            //Maps the added boat to the its DTO
            BoatDTO boatDTO = GenericMapper.MapToBoatDTO(addedBoat);

            response = ResponseMessageHelper.CreateResponse(HttpStatusCode.OK, false, boatDTO, ConstantResponse.TEAM_BOAT_SUCCESS);
            return(Request.CreateResponse <CustomResponse>(HttpStatusCode.OK, response));
        }
Esempio n. 16
0
        internal static TblReservationMainDetailsViewModel MaptoViewModel(Tbl_ReservationMainDetails resRow, ObservableCollection <Fabric_UnitID> mainFabricList, ObservableCollection <GetItemOnhand_Result> onHandList)
        {
            var detailsList = new ObservableCollection <TblReservationDetailsViewModel>();

            foreach (var row in resRow.Tbl_ReservationDetails)
            {
                var newDetail = new TblReservationDetailsViewModel();
                GenericMapper.InjectFromObCollection(newDetail.ReservationListRec, row.Tbl_ReservationRec);
                newDetail.InjectFrom(row);
                detailsList.Add(newDetail);
            }

            double onhand = 0;

            try
            {
                onhand = Convert.ToDouble(onHandList.FirstOrDefault(w => w.FabricCode == resRow.Fabric && w.CONFIGID == resRow.FabricColor && w.TOBATCH == resRow.Batchno).Qty);
            }
            catch (Exception)
            {
                onhand = 0;
            }

            var newRow = new TblReservationMainDetailsViewModel();

            newRow.InjectFrom(resRow);
            newRow.ReservationDetailsViewModelList = detailsList;
            newRow.RemQtyTemp = newRow.Qty - newRow.ReservationDetailsViewModelList.Sum(x => x.IntialQty);
            newRow.RemQty     = newRow.RemQtyTemp;
            newRow.OnHandQty  = onhand;
            //  newRow.FabricName = mainFabricList.FirstOrDefault(x => x.Fabric_Code == newRow.Fabric).Fabric_Ename;
            return(newRow);
        }
Esempio n. 17
0
        public void SaveMainRow()
        {
            if (SelectedMainRow != null)
            {
                var valiationCollection = new List <ValidationResult>();

                var isvalid = Validator.TryValidateObject(SelectedMainRow, new ValidationContext(SelectedMainRow, null, null), valiationCollection, true);

                if (SelectedMainRow.DetailsList.Sum(x => x.Percentage) != 100)
                {
                    isvalid = false;
                    MessageBox.Show("Total Percentage Should Be !00%");
                }

                if (isvalid)
                {
                    var saveRow = new TblPaymentSchedule();
                    var save    = SelectedMainRow.Iserial == 0;
                    saveRow.InjectFrom(SelectedMainRow);
                    saveRow.TblPaymentScheduleDetails = new ObservableCollection <TblPaymentScheduleDetail>();
                    GenericMapper.InjectFromObCollection(saveRow.TblPaymentScheduleDetails, SelectedMainRow.DetailsList);
                    Client.UpdateOrInsertTblPaymentScheduleAsync(saveRow, save, MainRowList.IndexOf(SelectedMainRow));
                }
            }
        }
        public FindOutputManagersResponse FindOutputManagers(FindOutputManagersRequest request)
        {
            IClaimsIdentity identity = (IClaimsIdentity)Thread.CurrentPrincipal.Identity;
            string          upn      = identity.Claims.FindAll(c => { return(c.ClaimType == ClaimTypes.Upn); }).First().Value;

            InitializationActions.FindOutputManagersAction action = PolicyInjection.Create <InitializationActions.FindOutputManagersAction>();

            InitializationEntities.FindOutputManagersParameters parameters = Translators.FindOutputManagersTranslator.TranslateFromServiceToBusiness(request.FindOutputManagersParameters);

            //parameters.UserPrincipalIdentity = upn; /* user@domain */
            //parameters.UserIdentity = upn.Split('@')[0];


            InitializationEntities.FindOutputManagersResult r = action.Execute();

            FindOutputManagersResponse response = new FindOutputManagersResponse();

            response.FindOutputManagerResult = GenericMapper.MapNew <DataContracts.FindOutputManagerResult>(r);

            response.FindOutputManagerResult.OutputManagers =
                GenericMapper.MapListNew <DataContracts.OutputManagerCollection, InitializationEntities.FindOutputManagerResult, DataContracts.OutputManager>(
                    r.OutputManagers, Translators.FindOutputManagersTranslator.TranslateFromBusinessToService);


            return(response);
        }
Esempio n. 19
0
        public List <PostListItemViewModel> ListPostsByAuthor(string userName)
        {
            var result = new List <PostListItemViewModel>();

            var posts = _postsService.ListPostsByAuthor(userName);

            return(posts.Count() == 0 ? null : GenericMapper.MapListOfObjects <PostListItemViewModel>(posts).ToList());
        }
Esempio n. 20
0
        public List <PostListItemViewModel> ListAllPosts()
        {
            var result = new List <PostListItemViewModel>();

            var posts = _postsService.ListAllPosts();

            return(posts.Count() == 0 ? null : GenericMapper.MapListOfObjects <PostListItemViewModel>(posts).ToList());
        }
Esempio n. 21
0
        public List <PageListItemViewModel> ListAllPages()
        {
            var result = new List <FullPageViewModel>();

            var pages = _pagesService.ListAllPages();

            return(pages.Count() == 0 ? null : GenericMapper.MapListOfObjects <PageListItemViewModel>(pages).ToList());
        }
Esempio n. 22
0
        public List <PostListItemViewModel> LoadNextPosts(int loadedItems, int itemsCount)
        {
            var result = new List <PostListItemViewModel>();

            var posts = _postsService.LoadNextPosts(loadedItems, itemsCount);

            return(posts.Count() == 0 ? null : GenericMapper.MapListOfObjects <PostListItemViewModel>(posts).ToList());
        }
        public async Task <List <PostCodeDTO> > GetPostCodes(List <Guid> postcodeGuids, Guid unitGuid)
        {
            var result = await(from pc in DataContext.Postcodes.AsNoTracking()
                               join ul in DataContext.UnitLocationPostcodes.AsNoTracking() on pc.ID equals ul.PoscodeUnit_GUID
                               where postcodeGuids.Contains(pc.ID) && ul.Unit_GUID == unitGuid
                               select pc).ToListAsync();

            return(GenericMapper.MapList <Postcode, PostCodeDTO>(result));
        }
 public UserDomainService(
     IUserRepository repository,
     IRefreshTokenRepository refreshTokenRepository,
     IMapper mapper) : base(mapper)
 {
     _repository             = repository;
     _refreshTokenRepository = refreshTokenRepository;
     _refreshMapper          = new GenericMapper <RefreshToken, RefreshTokenViewModel>(mapper);
 }
        public async Task <PostCodeDTO> GetSelectedPostcode(Guid postcodeGuid, Guid unitGuid)
        {
            var result = await(from pc in DataContext.Postcodes.AsNoTracking()
                               join ul in DataContext.UnitLocationPostcodes.AsNoTracking() on pc.ID equals ul.PoscodeUnit_GUID
                               where pc.ID == postcodeGuid && ul.Unit_GUID == unitGuid
                               select pc).SingleOrDefaultAsync();

            return(GenericMapper.Map <Postcode, PostCodeDTO>(result));
        }
Esempio n. 26
0
 public Task <UserDTO> Add(UserDTO user)
 {
     return(Task.Run(() =>
     {
         User newUser = new GenericMapper <UserDTO, User>().Map(user);
         _db.Users.Add(newUser);
         _db.SaveChanges();
         return user;
     }));
 }
Esempio n. 27
0
        private void DisplayPermtions(List <TblAuthPermission> result)
        {
            GenericMapper.InjectFromObCollection(TblAuthPermissionsList, result.Where(x => x.ParentPerm == 0));

            foreach (var tblAuthPermission in TblAuthPermissionsList)
            {
                //  GetImageListKey(tblAuthPermission, tblAuthPermission.PermissionTyp);
                FillMyChild(tblAuthPermission, result.Where(x => x.ParentPerm != 0).ToList());
            }
            Loading = false;
        }
        /// <summary>
        /// Get route details specific to postcode
        /// </summary>
        /// <param name="postcodeUnit">Post code</param>
        /// <param name="locationId">selected unit's location ID</param>
        /// <returns>List of routes</returns>
        public async Task <List <RouteDTO> > GetPostcodeSpecificRoutes(string postcodeUnit, Guid locationId)
        {
            if (string.IsNullOrEmpty(postcodeUnit))
            {
                throw new ArgumentNullException(nameof(postcodeUnit));
            }

            if (locationId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(locationId));
            }

            using (loggingHelper.RMTraceManager.StartTrace("Business.GetPostcodeSpecificRoutes"))
            {
                string          methodName = typeof(DeliveryRouteBusinessService) + "." + nameof(GetPostcodeSpecificRoutes);
                List <RouteDTO> routes     = new List <RouteDTO>();
                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodEntryEventId);

                var postcode = await postCodeDataService.GetPostcode(postcodeUnit);

                var routeDetails = await deliveryRouteDataService.GetRoutesByLocation(locationId);

                if (routeDetails != null && routeDetails.Count > 0)
                {
                    if (postcode != null && (postcode.PrimaryRouteGUID != null || postcode.SecondaryRouteGUID != null))
                    {
                        foreach (var route in routeDetails)
                        {
                            if (route.ID == postcode.PrimaryRouteGUID)
                            {
                                routes.Add(new RouteDTO {
                                    ID = route.ID, RouteName = DeliveryRouteConstants.PrimaryRoute + route.RouteName
                                });
                            }
                            else if (route.ID == postcode.SecondaryRouteGUID)
                            {
                                routes.Add(new RouteDTO {
                                    ID = route.ID, RouteName = DeliveryRouteConstants.SecondaryRoute + route.RouteName
                                });
                            }
                        }
                    }
                    else
                    {
                        routes = GenericMapper.MapList <RouteDataDTO, RouteDTO>(routeDetails);
                    }
                }

                loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodExitEventId);

                return(routes.OrderBy(n => n.RouteName).ToList());
            }
        }
        /// <summary>
        /// This Method is used to Access Link data for defined coordinates.
        /// </summary>
        /// <param name="boundingBoxCoordinates">BoundingBox Coordinates</param>
        /// <param name="unitGuid">unit unique identifier.</param>
        /// <returns>List of Access Link Dto</returns>
        public List <AccessLinkDTO> GetAccessLinks(string boundingBoxCoordinates, Guid unitGuid)
        {
            using (loggingHelper.RMTraceManager.StartTrace("DataService.GetAccessLinks"))
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Information, null, LoggerTraceConstants.Category, LoggerTraceConstants.AccessLinkAPIPriority, LoggerTraceConstants.AccessLinkDataServiceMethodEntryEventId, LoggerTraceConstants.Title);

                List <AccessLink> result = GetAccessLinkCoordinatesDataByBoundingBox(boundingBoxCoordinates, unitGuid).ToList();
                var accessLink           = GenericMapper.MapList <AccessLink, AccessLinkDTO>(result);
                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Information, null, LoggerTraceConstants.Category, LoggerTraceConstants.AccessLinkAPIPriority, LoggerTraceConstants.AccessLinkDataServiceMethodExitEventId, LoggerTraceConstants.Title);
                return(accessLink);
            }
        }
Esempio n. 30
0
        public FullImageObjectViewModel Create(FullImageObjectViewModel image)
        {
            var result = new FullImageObjectViewModel();

            var createdEntity = _imageObjectsService.UploadImage(image.Content, image.Name, image.Description, HttpContext.User.Identity.Name);

            if (createdEntity != null)
            {
                result = GenericMapper.MapObject <FullImageObjectViewModel>(createdEntity);
            }

            return(result);
        }
Esempio n. 31
0
 public List<Kingdom> GetKingdomList()
 {
     var mapper = new GenericMapper<Kingdom>();
     return StoredProcToList("spBiotaDefKingdomList", mapper);
 }