Ejemplo n.º 1
0
        public async Task <bool> Activate(UserInfo user, string Id, bool isDeleteOldData, CancellationToken cancellationToken = default(CancellationToken))
        {
            var response = await _icustomerInfoStore.GetAsync(a => a.Where(b => b.Id == Id));

            if (response.UserId == user.Id || ((await _permissionExpansionManager.GetLowerDepartments(user.OrganizationId)).Contains(response.DepartmentId) && (await _permissionExpansionManager.HavePermission(user.Id, "ActivateCustomer"))))
            {
                return(await Store.ActivateLossUser(user, Id, isDeleteOldData, cancellationToken));
            }
            return(false);
        }
Ejemplo n.º 2
0
        public virtual async Task <CustomerDealResponse> FindByTransactionsIdSaleManagerAsync(UserInfo user, string id, CancellationToken cancellationToken = default(CancellationToken))
        {
            var query  = _icustomerDealStore.CustomerDealAll();
            var organs = await _permissionExpansionManager.GetLowerDepartments(user.OrganizationId);

            query = query.Where(x => x.FlowId == id && !x.IsDeleted && organs.Contains(x.DepartmentId));
            var deal = await query.FirstOrDefaultAsync(cancellationToken);

            if (deal == null)
            {
                return(null);
            }
            //var _shopsInterface = ApplicationContext.Current.Provider.GetRequiredService<IShopsInterface>();
            //var val = (await _shopsInterface.IsResidentUser(userid, deal.ProjectId));
            //if (!val.Extension)
            //{

            //}


            deal.DepartmentName = _iorganizationExpansionStore.GetFullName(deal.DepartmentId);
            var phone = new Help.EncDncHelper().Decrypt(deal.CustomerPhone);

            if (!string.IsNullOrEmpty(phone))
            {
                deal.CustomerPhone = System.Text.RegularExpressions.Regex.Replace(phone, "(\\d{3})\\d{4}(\\d{4})", "$1****$2");
            }
            CustomerDealResponse customerDealResponse = _mapper.Map <CustomerDealResponse>(deal);

            customerDealResponse.FileList       = new List <DealFileItemResponse>();
            customerDealResponse.AttachmentList = new List <DealAttachmentResponse>();

            if (deal.DealFileInfos != null && deal.DealFileInfos.Count() > 0)
            {
                var f = deal.DealFileInfos.Select(a => a.FileGuid).Distinct();
                foreach (var item in f)
                {
                    var f1 = deal.DealFileInfos.Where(a => a.Type != "Attachment" && a.FileGuid == item).ToList();
                    if (f1?.Count > 0)
                    {
                        customerDealResponse.FileList.Add(ConvertToFileItem(item, f1));
                    }
                    var f2 = deal.DealFileInfos.Where(a => a.Type == "Attachment" && a.FileGuid == item).ToList();
                    if (f2?.Count > 0)
                    {
                        customerDealResponse.AttachmentList.AddRange(ConvertToAttachmentItem(f2));
                    }
                }
            }
            return(customerDealResponse);
        }