示例#1
0
        public static void InitializeAopContainer()
        {
            AopEngine.Initialize();
            InitializeLibrary();

            MapEntities();
        }
示例#2
0
        /// <summary>
        /// Method to get partner meeting survey questions
        /// </summary>
        /// <param name="userRoleID">user role ID</param>
        /// <param name="userID">user ID</param>
        /// <returns>returns questions</returns>
        public IList <SurveyModuleDTO> GetSurveyPartnerQuestions(long userRoleID, long userID)
        {
            IList <SurveyQuestionDTO> questions = new List <SurveyQuestionDTO>();

            ObjectMapper.Map(ActivityRepository.GetSurveyPartnerQuestions(userRoleID, userID), questions);
            IList <SurveyQuestionAttributeDTO> attributes = GetSurveyQuestionAttributes();
            IList <UserModuleDTO> modules = AopEngine.Resolve <IUserService>(AspectEnums.AspectInstanceNames.UserManager, AspectEnums.ApplicationName.Samsung).GetUserModules(userID, userRoleID);
            int partnerModuleID           = 0;
            var partnerModule             = modules.FirstOrDefault(k => k.ModuleCode == (int)AspectEnums.AppModules.PartnerMeeting);

            if (partnerModule != null)
            {
                partnerModuleID = partnerModule.ModuleID;
            }
            List <SurveyModuleDTO> surveyModules = modules.Where(k => k.ModuleID == partnerModuleID).OrderBy(h => h.Sequence).Select(k => new SurveyModuleDTO()
            {
                ModuleCode = k.ModuleCode.HasValue ? k.ModuleCode.Value : 0,
                ModuleID   = k.ModuleID,
                Name       = k.Name
            }).ToList();

            surveyModules.ForEach(k =>
            {
                k.Questions = questions.Where(question => question.ModuleID == k.ModuleID).OrderBy(j => j.Sequence).ToList();
                if (k.Questions != null)
                {
                    k.Questions.ForEach(j =>
                    {
                        j.Options = attributes.Where(h => h.SurveyQuestionID == j.SurveyQuestionID).OrderBy(t => t.Sequence).ToList();
                    });
                }
            });
            return(surveyModules);
        }
示例#3
0
        /// <summary>
        /// Method to update samsung orders in DMS
        /// </summary>
        /// <param name="orders">order collection</param>
        /// <param name="salesmanCode">salesman code</param>
        private void UpdateSamsungDMSOrders(IList <OrderBookingSurvey> orders, string salesmanCode)
        {
            IOrderBooking orderInstance = AopEngine.Resolve <IOrderBooking>("Samsung_OrderManager");

            foreach (var item in orders)
            {
                //using (TransactionScope scope = new TransactionScope())
                //{
                var storeDetail = "";   // StoreRepository.GetStoreDetails(item.StoreID);
                // var storeParentDetails = StoreRepository.GetUserStoreParentDetails(item.UserID, item.StoreID);
                var productDetails = SystemRepository.GetProductDetails(item.ProductID.Value);
                if (storeDetail != null && productDetails != null)
                {
                    OrderBooking order = new OrderBooking()
                    {
                        OrderDate  = item.CreatedDate,
                        OrderQty   = item.Quantity,
                        OrderKeyNo = item.OrderNo,
                        //RTRCode = storeDetail.StoreCode,
                        // DistyCode = storeParentDetails != null? storeParentDetails.ShipToCode:string.Empty,
                        ProductCode  = productDetails.SKUCode,
                        OrderID      = item.OrderBookingID,
                        SRPCode      = salesmanCode,
                        CreatedDate  = System.DateTime.Now,
                        ModifiedDate = System.DateTime.Now,
                        CreatedBy    = item.UserID.ToString(),
                        ModifiedBy   = item.UserID.ToString(),
                        RouteCode    = item.CoverageID.HasValue ? item.CoverageID.Value.ToString() : string.Empty,
                        DownloadFlag = "N",
                    };
                    bool isSuccess = orderInstance.SaveOrderInDMS(order);
                    ActivityRepository.UpdateOrderSyncStatus(order.OrderID, isSuccess ? 3 : 2);
                }

                //}
            }
        }
示例#4
0
        /// <summary>
        /// Method to get survey questions on the basis of user profile selected
        /// </summary>
        /// <param name="userRoleID">user profile ID</param>
        /// <param name="userID">user primary ID</param>
        /// <returns>returns questions list</returns>
        public IList <SurveyModuleDTO> GetSurveyQuestions(long userRoleID, long userID, int RowCount, int StartRowIndex, DateTime?LastUpdatedDate, out bool HasMoreRows, out DateTime?MaxModifiedDate)
        {
            IList <SurveyQuestionDTO> questions = new List <SurveyQuestionDTO>();

            ObjectMapper.Map(ActivityRepository.GetSurveyQuestions(userRoleID, userID, RowCount, StartRowIndex, LastUpdatedDate, out HasMoreRows, out MaxModifiedDate), questions);

            IList <SurveyQuestionAttributeDTO> attributes = GetSurveyQuestionAttributes();


            bool     HasMoreRowsModules     = false;
            DateTime?MaxModifiedDateModules = null;
            IList <UserModuleDTO> modules   = AopEngine.Resolve <IUserService>(AspectEnums.AspectInstanceNames.UserManager, AspectEnums.ApplicationName.Samsung)
                                              .GetUserModules(userID, userRoleID, RowCount, StartRowIndex, LastUpdatedDate, out HasMoreRowsModules, out MaxModifiedDateModules, true).ToList();//using this method to pick all methods deleted or not deleted

            #region select only those modules whose questions are changed

            List <SurveyModuleDTO> surveyModules = (from m in modules
                                                    join q in questions
                                                    on m.ModuleCode equals q.ModuleCode
                                                    select m).OrderBy(h => h.Sequence)
                                                   .Select(k => new SurveyModuleDTO()
            {
                ModuleCode = k.ModuleCode.HasValue ? k.ModuleCode.Value : 0,
                ModuleID   = k.ModuleID,
                Name       = k.Name
            }).Distinct().OrderBy(k => k.Sequence).ToList();
            #endregion

            //                     channelTypeDisplay = (from CTM in SmartDostDbContext.ChannelTypeTeamMappings
            //join CTD in SmartDostDbContext.ChannelTypeDisplays on CTM.ChannelType equals CTD.ChannelType into ej
            //from CTD in ej.DefaultIfEmpty()
            //where CTM.IsDeleted == false
            //select new { CType = CTM.ChannelType, IsDisplay = CTD == null ? false : CTD.IsDisplayCounterShare, IsPlanogram = CTD == null ? false : CTD.IsPlanogram, ChannelTypeDisplayID = CTD == null ? 0 : CTD.ChannelTypeDisplayID }
            //).AsEnumerable().Select(d => new ChannelTypeDisplay() { ChannelType = d.CType, IsPlanogram = d.IsPlanogram, IsDisplayCounterShare = d.IsDisplay, ChannelTypeDisplayID = d.ChannelTypeDisplayID }).Distinct().ToList();



            //List<SurveyModuleDTO> surveyModules = modules.OrderBy(h => h.Sequence)
            //    .Select(k => new SurveyModuleDTO()
            //{
            //    ModuleCode = k.ModuleCode.HasValue ? k.ModuleCode.Value : 0,
            //    ModuleID = k.ModuleID,
            //    Name = k.Name
            //}).OrderBy(k => k.Sequence).ToList();

            surveyModules.ForEach(k =>
            {
                k.Questions = questions.Where(question => question.ModuleID == k.ModuleID).OrderBy(j => j.Sequence).ToList();
                if (k.Questions != null)
                {
                    k.Questions.ForEach(j =>
                    {
                        j.Options = attributes.Where(h => h.SurveyQuestionID == j.SurveyQuestionID).OrderBy(t => t.Sequence).ToList();

                        if (j.IsDeleted == true)
                        {
                            foreach (var item in j.Options)
                            {
                                item.IsDeleted = true;
                            }
                        }
                    });
                }
            });


            return(surveyModules);
        }