예제 #1
0
        /// <summary>
        /// 根据条件获取分页数据
        /// </summary>
        /// <param name="input">查询条件的类</param>
        public async Task <PagedResultOutput <OperateLogOutputDto> > GetPageListByCondition(QueryOperateLogInputDto input, int pageSize, int pageIndex)
        {
            try
            {
                List <OperateLogEntity> query = GetAllListByCondition(input).Result;
                int count = 0;
                List <OperateLogEntity> result = null;
                if (query != null)
                {
                    count  = query.Count();
                    result = query.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
                }

                IReadOnlyList <OperateLogOutputDto> ir;
                if (result != null)
                {
                    ir = result.MapTo <List <OperateLogOutputDto> >();
                }
                else
                {
                    ir = new List <OperateLogOutputDto>();
                }
                PagedResultOutput <OperateLogOutputDto> outputList = new PagedResultOutput <OperateLogOutputDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// 根据AreaCode获取所有权限下用户
        /// </summary>
        /// <param name="areaCode">登陆人对应权限编号</param>
        public async Task <PagedResultOutput <SystemUserDto> > GetPageUserByAreaCode(QueryUserInputDto input, int pageSize, int pageIndex)
        {
            try
            {
                List <SystemUserEntity> query = GetAllUserByUserAreaCode(input.UserCode, input.AreaCode).Result;

                if (!string.IsNullOrEmpty(input.UserName))
                {
                    query = query.Where(s => s.UserName.Contains(input.UserName)).ToList();
                }

                int count  = query.Count();
                var result = query.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();

                IReadOnlyList <SystemUserDto> ir;
                if (result != null && result.Count > 0)
                {
                    ir = result.MapTo <List <SystemUserDto> >();
                }
                else
                {
                    ir = new List <SystemUserDto>();
                }
                PagedResultOutput <SystemUserDto> outputList = new PagedResultOutput <SystemUserDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #3
0
        public virtual PagedResultOutput <TEntityDto> GetAll(TSelectRequestInput input)
        {
            var query = CreateQueryable(input);
            PagedResultOutput <TEntityDto> output = new PagedResultOutput <TEntityDto>();

            //进行排序
            if (!string.IsNullOrWhiteSpace(input.Sorting))
            {
                string[] temp = input.Sorting.Trim().Split(' ');
                query = temp.Length > 0
                    ? query.OrderBy(temp[0], temp.All(t => t != "asc"))
                    : query.OrderByDescending(t => t.Id);
            }
            else
            {
                query = query.OrderByDescending(t => t.Id);
            }
            //input.MaxResultCount == 0 不进行分页
            if (input.Page <= 0)
            {
                output.TotalCount = query.Count();
                output.Items      = query.MapTo <List <TEntityDto> >();
            }
            else
            {
                output.TotalCount = query.Count();
                output.Items      = query.PageBy(input).MapTo <List <TEntityDto> >();
            }
            return(output);
        }
예제 #4
0
        public async Task <PagedResultOutput <OrganizationUnitUserListDto> > GetOrganizationUnitUsers(GetOrganizationUnitUsersInput input)
        {
            var result = from uou in _userOrganizationUnitRepository.GetAll()
                         join ou in _organizationUnitRepository.GetAll() on uou.OrganizationUnitId equals ou.Id
                         join user in UserManager.Users on uou.UserId equals user.Id
                         where uou.OrganizationUnitId == input.Id
                         orderby input.Sorting
                         select new
            {
                uou,
                user
            };
            int resultCount = await result.CountAsync();

            var pagedResult = await result.PageBy(input).ToListAsync();

            PagedResultOutput <OrganizationUnitUserListDto> pagedResultOutput = new PagedResultOutput <OrganizationUnitUserListDto>(resultCount, pagedResult.Select((item) =>
            {
                OrganizationUnitUserListDto creationTime = item.user.MapTo <OrganizationUnitUserListDto>();
                creationTime.AddedTime = item.uou.CreationTime;
                return(creationTime);
            }).ToList());

            return(pagedResultOutput);
        }
예제 #5
0
        /// <summary>
        /// 通过areaCode查询数据结果
        /// </summary>
        /// <param name="areaCode">登陆人对应权限编号</param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <returns></returns>
        public async Task <PagedResultOutput <SystemUserDto> > GetAllPageListByCondition(SystemUserDto input, int PageSize, int PageIndex)
        {
            try
            {
                List <SystemUserEntity> query = GetDataByUserCodeAsync(input.UserCode.Trim(), input.Department.Trim(), input.UserName.Trim()).Result;
                int count  = query.Count();
                var result = query.OrderByDescending(p => p.CreateDT).Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();

                IReadOnlyList <SystemUserDto> ir;
                if (result != null && result.Count > 0)
                {
                    ir = result.MapTo <List <SystemUserDto> >();
                }
                else
                {
                    ir = new List <SystemUserDto>();
                }
                PagedResultOutput <SystemUserDto> outputList = new PagedResultOutput <SystemUserDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #6
0
        /// <summary>
        /// 根据LayerID获取分页数据
        /// </summary>
        /// <param name="layerID">图层ID</param>
        public async Task <PagedResultOutput <OperateLogOutputDto> > GetPageListByLayerID(string layerID, int pageSize, int pageIndex)
        {
            try
            {
                List <OperateLogEntity> query = GetAllListByLayerID(layerID).Result;
                int count  = query.Count();
                var result = query.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();

                IReadOnlyList <OperateLogOutputDto> ir;
                if (result != null && result.Count > 0)
                {
                    ir = result.MapTo <List <OperateLogOutputDto> >();
                }
                else
                {
                    ir = new List <OperateLogOutputDto>();
                }
                PagedResultOutput <OperateLogOutputDto> outputList = new PagedResultOutput <OperateLogOutputDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #7
0
        public async Task <PagedResultOutput <NameValueDto> > FindUsers(FindUsersInput input)
        {
            if (this.AbpSession.MultiTenancySide == MultiTenancySides.Host && input.TenantId.HasValue)
            {
                IActiveUnitOfWork currentUnitOfWork = this.CurrentUnitOfWork;
                int?tenantId = input.TenantId;
                currentUnitOfWork.SetFilterParameter("MayHaveTenant", "tenantId", tenantId.Value);
            }
            IQueryable <User> users  = this.UserManager.Users;
            IQueryable <User> users1 = users.WhereIf <User>(!input.Filter.IsNullOrWhiteSpace(), (User u) => u.Name.Contains(input.Filter) || u.Surname.Contains(input.Filter) || u.UserName.Contains(input.Filter) || u.EmailAddress.Contains(input.Filter));
            int num = await users1.CountAsync <User>();

            IQueryable <User>        users2 = users1;
            IOrderedQueryable <User> name   =
                from u in users2
                orderby u.Name
                select u;
            List <User> listAsync = await name.ThenBy <User, string>((User u) => u.Surname).PageBy <User>(input).ToListAsync <User>();

            List <User> users3 = listAsync;
            int         num1   = num;
            List <User> users4 = users3;
            PagedResultOutput <NameValueDto> pagedResultOutput = new PagedResultOutput <NameValueDto>(num1, (
                                                                                                          from u in users4
                                                                                                          select new NameValueDto(string.Concat(new string[] { u.Name, " ", u.Surname, " (", u.EmailAddress, ")" }), u.Id.ToString())).ToList <NameValueDto>());

            return(pagedResultOutput);
        }
예제 #8
0
        /// <summary>
        /// 获取带count的分页列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <PagedResultOutput <LayerManagerDto> > GetPageListAndCount(QueryLayerManagerInput input)
        {
            var result = await _iLayerManagerRepository.GetPageList(input.Name, input.PageIndex, input.PageSize);

            IReadOnlyList <LayerManagerDto> ir = result.MapTo <List <LayerManagerDto> >();
            int count = _iLayerManagerRepository.Count();
            PagedResultOutput <LayerManagerDto> outputList = new PagedResultOutput <LayerManagerDto>(count, ir);

            return(outputList);
        }
예제 #9
0
        /// <summary>
        /// 按条件分页查询指定字段,并返回总数
        /// </summary>
        /// <param name="querySlopeInput"></param>
        /// <returns></returns>
        public async Task <PagedResultOutput <SlopeDto> > GetFieldsPageList(QuerySlopeInput querySlopeInput)
        {
            try
            {
                if (querySlopeInput.DISASTERUNITNAME == "" && querySlopeInput.LOCATION == "")
                {
                    var slope = _iSlopeRepository.GetAll()
                                .Select
                                    (s => new SlopeDto()
                    {
                        Id               = s.Id,
                        UNIFIEDCODE      = s.UNIFIEDCODE,
                        DISASTERUNITNAME = s.DISASTERUNITNAME,
                        LOCATION         = s.LOCATION,
                        UPDATETIME       = s.UPDATETIME,
                        SLOPETYPE        = s.SLOPETYPE
                    }
                                    )
                                .OrderBy(s => s.UNIFIEDCODE).Skip((querySlopeInput.PageIndex - 1) * querySlopeInput.PageSize).Take(querySlopeInput.PageSize);

                    IReadOnlyList <SlopeDto> ir = slope.MapTo <List <SlopeDto> >();
                    int count = await GetCount(querySlopeInput);

                    PagedResultOutput <SlopeDto> list = new PagedResultOutput <SlopeDto>(count, ir);
                    return(list);
                }
                else
                {
                    var slope = _iSlopeRepository.GetAll()
                                .Where(_iSlopeRepository.GetWhere(querySlopeInput.DISASTERUNITNAME, querySlopeInput.LOCATION))
                                .Select
                                    (s => new SlopeDto()
                    {
                        Id               = s.Id,
                        UNIFIEDCODE      = s.UNIFIEDCODE,
                        DISASTERUNITNAME = s.DISASTERUNITNAME,
                        LOCATION         = s.LOCATION,
                        UPDATETIME       = s.UPDATETIME,
                        SLOPETYPE        = s.SLOPETYPE
                    }
                                    )
                                .OrderBy(s => s.UNIFIEDCODE).Skip((querySlopeInput.PageIndex - 1) * querySlopeInput.PageSize).Take(querySlopeInput.PageSize);

                    IReadOnlyList <SlopeDto> ir = slope.MapTo <List <SlopeDto> >();
                    int count = await GetCount(querySlopeInput);

                    PagedResultOutput <SlopeDto> list = new PagedResultOutput <SlopeDto>(count, ir);
                    return(list);
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
예제 #10
0
        /// <summary>
        /// 根据条件获取分页数据
        /// </summary>
        /// <param name="input">查询条件的类</param>
        public async Task <PagedResultOutput <OperateLogOutputDto> > GetPageListByParamCondition(QueryOperateLogInputParamDto input, int pageIndex, int pageSize)
        {
            try
            {
                IEnumerable <OperateLogEntity> query = _IOperateLogRepository.GetAll();

                // 条件过滤
                if (input.UserName != null && input.UserName.Trim().Length > 0)
                {
                    query = query.Where(p => p.UserName.ToUpper().Contains(input.UserName.ToUpper()));
                }
                if (input.SystemFunc != null && input.SystemFunc.Trim().Length > 0)
                {
                    query = query.Where(p => p.SystemFunc.ToUpper().Contains(input.SystemFunc.ToUpper()));
                }
                if (input.OperateType != null && input.OperateType.Trim().Length > 0)
                {
                    query = query.Where(p => p.OperateType.ToUpper().Contains(input.OperateType.ToUpper()));
                }
                if (input.StartDate != null)
                {
                    query = query.Where(s => s.OperateTime >= input.StartDate.Value.AddHours(-1));
                }
                if (input.EndDate != null)
                {
                    query = query.Where(s => s.OperateTime <= input.EndDate.Value.AddDays(1).AddHours(-1));
                }

                int count = 0;
                List <OperateLogEntity> result = null;
                if (query != null)
                {
                    count  = query.Count();
                    result = query.OrderByDescending(p => p.OperateTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
                }

                IReadOnlyList <OperateLogOutputDto> ir;
                if (result != null)
                {
                    ir = result.MapTo <List <OperateLogOutputDto> >();
                }
                else
                {
                    ir = new List <OperateLogOutputDto>();
                }
                PagedResultOutput <OperateLogOutputDto> outputList = new PagedResultOutput <OperateLogOutputDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #11
0
        /// <summary>
        /// 根据条件获取分页数据
        /// </summary>
        /// <param name="input">查询条件的类</param>
        public async Task <PagedResultOutput <ShpFileReadLogOutputDto> > GetGeologgerPageListByCondition(QueryShpFileReadLogInputParamDto input)
        {
            try
            {
                IEnumerable <ShpFileReadLogEntity> query = _IShpFileReadLogRepository.GetAll();

                // 条件过滤
                if (input.Createby != null && input.Createby.Trim().Length > 0)
                {
                    query = query.Where(p => p.CreateBy.ToUpper().Contains(input.Createby.ToUpper()));
                }
                if (input.Readstatus != 0)
                {
                    query = query.Where(p => p.ReadStatus == input.Readstatus);
                }
                if (input.Message != null && input.Message.Trim().Length > 0)
                {
                    query = query.Where(p => p.Message.ToUpper().Contains(input.Message.ToUpper()));
                }
                if (input.StartDate != null)
                {
                    query = query.Where(s => s.CreateDT >= input.StartDate.Value.AddHours(-1));
                }
                if (input.EndDate != null)
                {
                    query = query.Where(s => s.CreateDT <= input.EndDate.Value.AddDays(1).AddHours(-1));
                }

                int count = 0;
                List <ShpFileReadLogEntity> result = null;
                if (query != null)
                {
                    count  = query.Count();
                    result = query.OrderByDescending(p => p.CreateDT).Skip((input.pageIndex - 1) * input.pageSize).Take(input.pageSize).ToList();
                }

                IReadOnlyList <ShpFileReadLogOutputDto> ir;
                if (result != null)
                {
                    ir = result.MapTo <List <ShpFileReadLogOutputDto> >();
                }
                else
                {
                    ir = new List <ShpFileReadLogOutputDto>();
                }
                PagedResultOutput <ShpFileReadLogOutputDto> outputList = new PagedResultOutput <ShpFileReadLogOutputDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #12
0
        public async Task <PartialViewResult> CreateOrUpdateModal(long?id = null)
        {
            IProductAppService     productAppService = this._productAppService;
            NullableIdInput <long> nullableIdInput   = new NullableIdInput <long>()
            {
                Id = id
            };
            CreateOrUpdateProductModalViewModel createOrUpdateProductModalViewModel = new CreateOrUpdateProductModalViewModel(await productAppService.GetProductForEdit(nullableIdInput));

            if (!id.HasValue)
            {
                createOrUpdateProductModalViewModel.CanMakeActive = new bool?(false);
            }
            else
            {
                IPriceAppService      priceAppService       = this._priceAppService;
                GetProductPricesInput getProductPricesInput = new GetProductPricesInput()
                {
                    ProductId = id.Value
                };
                PagedResultOutput <ProductPriceListDto> prices = await priceAppService.GetPrices(getProductPricesInput);

                CreateOrUpdateProductModalViewModel nullable = createOrUpdateProductModalViewModel;
                IReadOnlyList <ProductPriceListDto> items    = prices.Items;
                nullable.CanMakeActive = new bool?((
                                                       from x in items
                                                       where x.IsActive
                                                       select x).Any <ProductPriceListDto>());
            }
            List <SelectListItem> selectListItems = new List <SelectListItem>();

            foreach (Lookup lookupItem in (new LookupFill("QuantityTypes", -1)).LookupItems)
            {
                SelectListItem selectListItem = new SelectListItem()
                {
                    Text     = lookupItem.Text,
                    Value    = lookupItem.Value,
                    Disabled = lookupItem.Disabled,
                    Selected = lookupItem.Selected
                };
                selectListItems.Add(selectListItem);
            }
            SelectListItem selectListItem1 = new SelectListItem()
            {
                Text     = "",
                Value    = "",
                Disabled = false
            };

            selectListItems.Insert(0, selectListItem1);
            this.ViewData["QuantitySoldInTypes"] = selectListItems;
            return(this.PartialView("_CreateOrUpdateModal", createOrUpdateProductModalViewModel));
        }
예제 #13
0
        /// <summary>
        /// 分页并返回数据总条数
        /// </summary>
        /// <param name="queryDto"></param>
        /// <returns></returns>
        public async Task <PagedResultOutput <DisasterDto> > GetPageAndCountList(QueryDisasterInput queryDto)
        {
            try
            {
                var disasterEntity = await _iDisasterRepository.GetPageList(queryDto.PageIndex, queryDto.PageSize);

                IReadOnlyList <DisasterDto> ir = disasterEntity.MapTo <List <DisasterDto> >();
                int count = _iDisasterRepository.Count();
                PagedResultOutput <DisasterDto> list = new PagedResultOutput <DisasterDto>(count, ir);
                return(list);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
예제 #14
0
        /// <summary>
        /// 分页条件查询,并返回总数
        /// </summary>
        /// <param name="querySlopeInput"></param>
        /// <returns></returns>

        public async Task <PagedResultOutput <SlopeDto> > GetPageAndCountList(QuerySlopeInput querySlopeInput)
        {
            try
            {
                var slope = await _iSlopeRepository.GetPageList(querySlopeInput.PageIndex, querySlopeInput.PageSize, querySlopeInput.DISASTERUNITNAME, querySlopeInput.LOCATION);

                IReadOnlyList <SlopeDto> ir = slope.MapTo <List <SlopeDto> >();
                int count = await GetCount(querySlopeInput);

                PagedResultOutput <SlopeDto> list = new PagedResultOutput <SlopeDto>(count, ir);
                return(list);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
예제 #15
0
        public async Task <PagedResultOutput <ProductSpecificPriceListDto> > GetSpecificPrices(GetProductSpecificPricesInput input)
        {
            IQueryable <ProductSpecificPrice> all      = this._specificPriceRepository.GetAll();
            IQueryable <ProductSpecificPrice> tenantId =
                from x in all
                where x.TenantId == (this.AbpSession.ImpersonatorTenantId.HasValue ? this.AbpSession.ImpersonatorTenantId.Value : this.AbpSession.TenantId.Value)
                select x;
            IQueryable <ProductSpecificPrice> productId = tenantId.WhereIf <ProductSpecificPrice>(!input.Filter.IsNullOrEmpty(), (ProductSpecificPrice p) => p.Cost == decimal.Parse(input.Filter));

            if (input.ProductId > (long)0)
            {
                IQueryable <ProductSpecificPrice> productSpecificPrices = this._specificPriceRepository.GetAll();
                productId =
                    from p in productSpecificPrices
                    where p.ProductId == input.ProductId
                    select p;
            }
            int num = await productId.CountAsync <ProductSpecificPrice>();

            List <ProductSpecificPrice> listAsync = await productId.OrderBy <ProductSpecificPrice>(input.Sorting, new object[0]).PageBy <ProductSpecificPrice>(input).ToListAsync <ProductSpecificPrice>();

            PagedResultOutput <ProductSpecificPriceListDto> pagedResultOutput = new PagedResultOutput <ProductSpecificPriceListDto>(num, listAsync.MapTo <List <ProductSpecificPriceListDto> >());

            if (pagedResultOutput.Items.Any <ProductSpecificPriceListDto>())
            {
                foreach (ProductSpecificPriceListDto item in pagedResultOutput.Items)
                {
                    if (item.ForOrganizationalUnitId.HasValue)
                    {
                        IOrganizationUnitAppService   organizationUnitAppService    = this._organizationUnitAppService;
                        GetOrganizationUnitUsersInput getOrganizationUnitUsersInput = new GetOrganizationUnitUsersInput()
                        {
                            Id             = item.ForOrganizationalUnitId.Value,
                            MaxResultCount = 1000
                        };
                        PagedResultOutput <OrganizationUnitUserListDto> organizationUnitUsers = await organizationUnitAppService.GetOrganizationUnitUsers(getOrganizationUnitUsersInput);

                        if (organizationUnitUsers.Items.Any <OrganizationUnitUserListDto>())
                        {
                            item.ForOrganizationalUnit.MemberCount = organizationUnitUsers.TotalCount;
                        }
                    }
                }
            }
            return(pagedResultOutput);
        }
        /// <summary>
        /// 获取所有角色信息
        /// </summary>
        /// <returns></returns>
        public PagedResultOutput <RoleListDto> GetRoles(FilterGroup filter)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            QueryModel model = new QueryModel(filter);

            int total;
            var data = GetQueryData <Role, int>(_roleManager.Roles, model)
                       .Where <Role>(model.PageIndex, model.PageSize, out total, model.PageCondition.SortConditions);
            var userListDtos = data.MapTo <List <RoleListDto> >();

            var result = new PagedResultOutput <RoleListDto>(total, userListDtos);

            sw.Stop();

            Console.WriteLine(sw.Elapsed);

            return(result);
        }
예제 #17
0
        public PagedResultOutput <SystemUserDto> GetUserGroupAlternativeUsers(string groupId, string userName, int PageSize, int PageIndex)
        {
            var data = new PagedResultOutput <SystemUserDto>();
            var db   = (InfoEarthFrameDbContext)_iGroupRepository.GetDbContext();

            var where = "";
            if (!string.IsNullOrEmpty(userName))
            {
                where += " AND u.\"UserName\" like '%" + userName + "%'";
            }
            var sql = "SELECT" +
                      "	u.*, (" +
                      "		CASE"+
                      "		WHEN r.\"UserId\" != \'\'"+
                      "		AND r.\"UserId\" IS NOT NULL THEN"+
                      "			1"+
                      "		ELSE"+
                      "			0"+
                      "		END"+
                      "	) AS isRelated" +
                      " FROM" +
                      "	sdms_user u" +
                      " LEFT JOIN (" +
                      "	SELECT" +
                      "		\"UserId\""+
                      "	FROM" +
                      "		\"TBL_GROUP_USER\" G"+
                      "	WHERE" +
                      "		G .\"GroupId\" = \'"+ groupId + "\'" +
                      "	GROUP BY" +
                      "		G .\"GroupId\","+
                      "		G .\"UserId\""+
                      " ) r ON r.\"UserId\" = u.\"Id\"  where 1=1 " + where + " ";
            var query = db.Database.SqlQuery <SystemUserDto>(sql);

            data.TotalCount = query.Count();
            data.Items      = query.OrderByDescending(p => p.CreateDT).Skip(PageSize * (PageIndex - 1)).Take(PageSize).ToList();
            return(data);
        }
예제 #18
0
        public async Task <PagedResultOutput <TenantListDto> > GetTenants(GetTenantsInput input)
        {
            var query = TenantManager.Tenants
                        .Include(t => t.Edition)
                        .WhereIf(
                !input.Filter.IsNullOrWhiteSpace(),
                t =>
                t.Name.Contains(input.Filter) ||
                t.TenancyName.Contains(input.Filter)
                );

            var tenantCount = await query.CountAsync();

            var sort    = input.sort.Replace("editionDisplayName", "Edition.DisplayName");
            var tenants = await query.OrderBy(string.Format("{0} {1}", sort, input.order)).PageBy(input).ToListAsync();

            var tem = new PagedResultOutput <TenantListDto>(
                tenantCount,
                tenants.MapTo <List <TenantListDto> >()
                );

            return(tem);
        }
예제 #19
0
        public PagedResultOutput <SystemUserDto> GetUserGroupRelatedUsers(string groupId, string userName, int PageSize, int PageIndex)
        {
            var data  = new PagedResultOutput <SystemUserDto>();
            var db    = (InfoEarthFrameDbContext)_iGroupRepository.GetDbContext();
            var query = from g in db.GroupUserEntities
                        join u in db.SysUser
                        on g.UserId equals u.Id into r
                        from row in r.DefaultIfEmpty()
                        select new SystemUserDto
            {
                CreateDT   = row.CreateDT,
                Department = row.Department,
                Id         = g.Id,
                Password   = row.Password,
                Phone      = row.Phone,
                Position   = row.Position,
                Remark     = row.Remark,
                TelPhone   = row.TelPhone,
                UserCode   = row.UserCode,
                UserName   = row.UserName,
                UserSex    = row.UserSex,
                GroupId    = g.GroupId
            };

            if (!string.IsNullOrEmpty(groupId))
            {
                query = query.Where(p => p.GroupId != null && p.GroupId == groupId);
            }
            if (!string.IsNullOrEmpty(userName))
            {
                query = query.Where(p => p.UserName != null && p.UserName.ToLower().Contains(userName.ToLower()));
            }

            data.TotalCount = query.Count();
            data.Items      = query.OrderByDescending(p => p.CreateDT).Skip(PageSize * (PageIndex - 1)).Take(PageSize).ToList();
            return(data);
        }
예제 #20
0
        /// <summary>
        /// 通过name或code查询数据结果
        /// </summary>
        /// <param name="input"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <returns></returns>
        public async Task <PagedResultOutput <SystemUserDto> > GetAllListByName(SystemUserDto input, int PageSize, int PageIndex)
        {
            try
            {
                string name = input.UserName;
                //var query = await _ISystemUserRepository.GetAllListAsync(q => (string.IsNullOrEmpty(name) ? true : (q.UserName.Contains(name) || q.UserCode.Contains(name))));
                //var query = _ISystemUserRepository.GetAllList(q => (string.IsNullOrEmpty(name) ? true : (q.UserName.Contains(name) || q.UserCode.Contains(name))));

                var expression = LinqExtensions.True <SystemUserEntity>();
                if (!string.IsNullOrEmpty(name))
                {
                    expression = expression.And(q => (q.UserName.Contains(name) || q.UserCode.Contains(name)));
                }
                var query = _ISystemUserRepository.GetAllList(expression);

                int count  = query.Count();
                var result = query.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();

                IReadOnlyList <SystemUserDto> ir;
                if (result != null && result.Count > 0)
                {
                    ir = result.MapTo <List <SystemUserDto> >();
                }
                else
                {
                    ir = new List <SystemUserDto>();
                }
                PagedResultOutput <SystemUserDto> outputList = new PagedResultOutput <SystemUserDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #21
0
        public async Task <PagedResultOutput <CustomerListDto> > GetCustomers(GetCustomersInput input)
        {
            PagedResultOutput <CustomerListDto> pagedResultOutput;
            ParameterExpression parameterExpression;

            if (input.Filter.Contains("id:"))
            {
                string filter             = input.Filter;
                char[] chrArray           = new char[] { ':' };
                long   theId              = long.Parse(filter.Split(chrArray)[1]);
                IQueryable <Customer> all = _customerRepository.GetAll();
                var customers             = all.Where(m => m.Id == theId);
                int num = await customers.CountAsync <Customer>();

                List <Customer> listAsync = await customers.OrderBy <Customer>(input.Sorting, new object[0]).PageBy <Customer>(input).ToListAsync <Customer>();

                pagedResultOutput = new PagedResultOutput <CustomerListDto>(num, listAsync.MapTo <List <CustomerListDto> >());
            }
            else
            {
                IQueryable <Address> addresses = this._addressRepository.GetAll();
                var addresses1 = addresses.Include(i => i.Country);
                var addresses2 = addresses1.Include(i => i.CountryRegion);
                var addresses3 = addresses2.Where(m => (int?)m.TenantId == AbpSession.TenantId && m.OwnerType == "Customer");
                var addresses4 = addresses3.WhereIf(!input.Filter.IsNullOrEmpty(),
                                                    p => p.Type.Contains(input.Filter) ||
                                                    p.Type.Contains(input.Filter) ||
                                                    p.PrimaryAddress.Contains(input.Filter) ||
                                                    p.SecondaryAddress.Contains(input.Filter) ||
                                                    p.City.Contains(input.Filter) ||
                                                    p.PostalCode.Contains(input.Filter) ||
                                                    p.ContactName.Contains(input.Filter) ||
                                                    p.Country.Code.Contains(input.Filter) ||
                                                    p.Country.Name.Contains(input.Filter) ||
                                                    p.CountryRegion.Code.Contains(input.Filter) ||
                                                    p.CountryRegion.Name.Contains(input.Filter));

                var collection = await addresses4.Select(s => new
                {
                    CustomerId = s.OwnerId
                }).ToListAsync();

                IQueryable <Phone> phones = this._phoneRepository.GetAll();
                var phones1 = phones.Where(m => (int?)m.TenantId == AbpSession.TenantId && m.OwnerType == "Customer");
                var phones2 = phones.WhereIf(!input.Filter.IsNullOrEmpty(),
                                             p => p.Type.Contains(input.Filter) ||
                                             p.PhoneNumber.Contains(input.Filter));
                var listAsync1 = await phones2.Select(p => new
                {
                    CustomerId = p.OwnerId
                }).ToListAsync();

                IQueryable <Customer> all1 = this._customerRepository.GetAll();
                var customers1             = all1.WhereIf(!input.Filter.IsNullOrEmpty(), p =>
                                                          p.FirstName.Contains(input.Filter) ||
                                                          p.LastName.Contains(input.Filter) ||
                                                          p.BusinessName.Contains(input.Filter) ||
                                                          p.Email.Contains(input.Filter));
                var listAsync2 = await customers1.Select(s => new
                {
                    CustomerId = s.Id
                }).ToListAsync();

                List <long> list = (
                    from s in collection
                    select s.CustomerId).ToList();
                IEnumerable <long> nums = list.Union((
                                                         from s in listAsync1
                                                         select s.CustomerId).ToList());
                nums.Union((
                               from s in listAsync2
                               select s.CustomerId).ToList());
                var all2 = _customerRepository.GetAll();
                parameterExpression = Expression.Parameter(typeof(Customer), "m");
                var customers2 = all2.Where(m => nums.Contains(m.Id));
                int matchCount = await customers2.CountAsync();

                List <Customer> listAsync3 = await customers2.OrderBy <Customer>(input.Sorting, new object[0]).PageBy <Customer>(input).ToListAsync <Customer>();

                pagedResultOutput = new PagedResultOutput <CustomerListDto>(matchCount, listAsync3.MapTo <List <CustomerListDto> >());
            }
            return(pagedResultOutput);
        }
예제 #22
0
        /// <summary>
        /// 获取地图列表(通过标签,类型,名称)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public PagedResultOutput <MapDto> GetPageListByName(MapInputDto input, int PageSize, int PageIndex)
        {
            try
            {
                string mapType = input.MapType, tag = input.MapTag, name = input.MapName, mapID = "", type = "";

                if (!string.IsNullOrEmpty(tag))
                {
                    mapID = GetMultiLayerIDByTag(tag);
                }

                if (!string.IsNullOrEmpty(mapType))
                {
                    type = GetMultiChildTypeByType(mapType);
                }

                if (string.IsNullOrWhiteSpace(input.CreateUserId))
                {
                    return(null);
                }

                var mapUserData = GetDataByUserCodeAsync(input.CreateUserId, name, type, mapID).Result;

                var listMapType    = _IDataTypeRepository.GetAll();
                var listMapRefence = _IDicDataCodeRepository.GetAll();
                var listMapScale   = _IDicDataCodeRepository.GetAll();

                var query = (from l in mapUserData
                             join t in listMapType on l.MapType equals t.Id into tt
                             from de in tt.DefaultIfEmpty()
                             join r in listMapRefence on l.SpatialRefence equals r.Id into rr
                             from re in rr.DefaultIfEmpty()
                             join dt in listMapScale on l.MapScale equals dt.Id into dtt
                             from ldt in dtt.DefaultIfEmpty()
                             select new MapDto
                {
                    Id = l.Id,
                    MapName = l.MapName,
                    MapEnName = l.MapEnName,
                    MapBBox = l.MapBBox,
                    MapPublishAddress = l.MapPublishAddress,
                    MapStatus = l.MapStatus,
                    MapDesc = l.MapDesc,
                    MapType = (de == null) ? "" : de.TypeName,
                    MapTag = l.MapTag,
                    PublishDT = l.PublishDT,
                    SortCode = l.SortCode,
                    EnabledMark = l.EnabledMark,
                    DeleteMark = l.DeleteMark,
                    CreateUserId = l.CreateUserId,
                    CreateUserName = l.CreateUserName,
                    CreateDT = Convert.ToDateTime(Convert.ToDateTime(l.CreateDT).ToString("yyyy-MM-ddTHH:mm:ss")),
                    ModifyUserId = l.ModifyUserId,
                    ModifyUserName = l.ModifyUserName,
                    ModifyDate = l.ModifyDate,
                    MapScale = l.MapScale,
                    MapScaleName = (ldt == null) ? "" : ldt.CodeName,
                    SpatialRefence = l.SpatialRefence,
                    SpatialRefenceName = (re == null) ? "" : re.CodeName,
                    MaxY = l.MaxY,
                    MinY = l.MinY,
                    MinX = l.MinX,
                    MaxX = l.MaxX,
                    MapLegend = l.MapLegend,
                    MaxDegLat = "",
                    MinDegLat = "",
                    MinDegLon = "",
                    MaxDegLon = ""
                }).OrderByDescending(x => x.CreateDT);
                int count  = query.Count();
                var result = query.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();



                IReadOnlyList <MapDto> ir = new List <MapDto>();
                if (result != null && result.Count > 0)
                {
                    foreach (var dto in result)
                    {
                        dto.MapTag    = GetMultiTagNameByMapID(dto.Id);
                        dto.MaxDegLat = (dto.MaxY != null) ? ConvertBBox(Convert.ToDouble(dto.MaxY)) : "";
                        dto.MinDegLat = (dto.MinY != null) ? ConvertBBox(Convert.ToDouble(dto.MinY)) : "";
                        dto.MaxDegLon = (dto.MaxX != null) ? ConvertBBox(Convert.ToDouble(dto.MaxX)) : "";
                        dto.MinDegLon = (dto.MinX != null) ? ConvertBBox(Convert.ToDouble(dto.MinX)) : "";
                    }
                    ir = result.MapTo <List <MapDto> >();
                }

                PagedResultOutput <MapDto> outputList = new PagedResultOutput <MapDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #23
0
        public async Task <PartialViewResult> CreateOrUpdateSpecificPriceModal(long productId, long?id = null)
        {
            int? nullable;
            bool flag;
            bool flag1;
            ISpecificPriceAppService specificPriceAppService = this._specificPriceAppService;
            NullableIdInput <long>   nullableIdInput         = new NullableIdInput <long>()
            {
                Id = id
            };
            GetProductSpecificPriceForEditOutput productSpecificPriceForEdit = await specificPriceAppService.GetProductSpecificPriceForEdit(nullableIdInput);

            CreateOrUpdateSpecificPriceModalViewModel createOrUpdateSpecificPriceModalViewModel = new CreateOrUpdateSpecificPriceModalViewModel(productSpecificPriceForEdit);
            Product product = await this._productAppService.GetProduct(productId);

            createOrUpdateSpecificPriceModalViewModel.BaseCost       = new decimal?(product.FinalPrice);
            createOrUpdateSpecificPriceModalViewModel.QuantitySoldIn = product.QuantitySoldIn;
            if (productSpecificPriceForEdit.SpecificPrice.ForCustomerId.HasValue)
            {
                ICustomerAppService customerAppService = this._customerAppService;
                GetCustomersInput   getCustomersInput  = new GetCustomersInput()
                {
                    MaxResultCount = 1,
                    Sorting        = "FirstName",
                    SkipCount      = 0
                };
                long value = productSpecificPriceForEdit.SpecificPrice.ForCustomerId.Value;
                getCustomersInput.Filter = string.Concat("id:", value.ToString());
                PagedResultOutput <CustomerListDto> customers = await customerAppService.GetCustomers(getCustomersInput);

                createOrUpdateSpecificPriceModalViewModel.CurrentlySelectedCustomerName = string.Concat(customers.Items[0].FullName, " - ", customers.Items[0].Email);
            }
            List <SelectListItem> selectListItems = new List <SelectListItem>();

            using (HttpClient httpClient = new HttpClient())
            {
                UrlHelper url = this.Url;
                nullable = (createOrUpdateSpecificPriceModalViewModel.SpecificPrice.ForCountryId.HasValue ? createOrUpdateSpecificPriceModalViewModel.SpecificPrice.ForCountryId : new int?(0));
                string str = url.RouteUrl("DefaultApiWithAction", new { httproute = "", controller = "Generic", action = "GetCountriesAsSelectListItems", countryId = 0, selectedCountryId = nullable }, this.Request.Url.Scheme);
                using (HttpResponseMessage async = await httpClient.GetAsync(str))
                {
                    if (async.IsSuccessStatusCode)
                    {
                        string str1 = await async.Content.ReadAsStringAsync();

                        selectListItems = JsonConvert.DeserializeObject <List <SelectListItem> >(str1);
                    }
                }
            }
            List <SelectListItem> selectListItems1 = selectListItems;
            SelectListItem        selectListItem   = new SelectListItem()
            {
                Text     = "",
                Value    = "",
                Disabled = false
            };

            selectListItems1.Insert(0, selectListItem);
            this.ViewData["Countries"] = selectListItems.AsEnumerable <SelectListItem>();
            List <OrganizationUnitDto> organizationUnitsByProperty = await this._organizationUnitAppService.GetOrganizationUnitsByProperty("SpecificPricesEnabled", "true");

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

            foreach (OrganizationUnitDto organizationUnitDto in organizationUnitsByProperty)
            {
                List <SelectListItem> selectListItems3 = selectListItems2;
                SelectListItem        selectListItem1  = new SelectListItem();
                string displayName = organizationUnitDto.DisplayName;
                int    memberCount = organizationUnitDto.MemberCount;
                selectListItem1.Text     = string.Format("{0} ({1} {2})", displayName, memberCount.ToString(), this.L("OUMemberCount"));
                selectListItem1.Value    = organizationUnitDto.Id.ToString();
                selectListItem1.Disabled = false;
                selectListItem1.Group    = null;
                flag = (!createOrUpdateSpecificPriceModalViewModel.SpecificPrice.ForOrganizationalUnitId.HasValue || createOrUpdateSpecificPriceModalViewModel.SpecificPrice.ForOrganizationalUnitId.Value != organizationUnitDto.Id ? false : true);
                selectListItem1.Selected = flag;
                selectListItems3.Add(selectListItem1);
            }
            SelectListItem selectListItem2 = new SelectListItem()
            {
                Text     = "",
                Value    = "",
                Disabled = false
            };

            selectListItems2.Insert(0, selectListItem2);
            this.ViewData["OrganizationUnits"] = selectListItems2.AsEnumerable <SelectListItem>();
            IRepository <ProductOption, long> repository = this._productOptionRepository;
            List <ProductOption> allListAsync            = await repository.GetAllListAsync((ProductOption x) => x.ProductId == product.Id && x.IsActive);

            List <ProductOption>  productOptions   = allListAsync;
            List <SelectListItem> selectListItems4 = new List <SelectListItem>();

            foreach (ProductOption productOption in productOptions)
            {
                List <SelectListItem> selectListItems5 = selectListItems4;
                SelectListItem        selectListItem3  = new SelectListItem()
                {
                    Text     = productOption.Name,
                    Value    = productOption.Id.ToString(),
                    Disabled = false,
                    Group    = null
                };
                flag1 = (!createOrUpdateSpecificPriceModalViewModel.SpecificPrice.ProductOptionId.HasValue || createOrUpdateSpecificPriceModalViewModel.SpecificPrice.ProductOptionId.Value != productOption.Id ? false : true);
                selectListItem3.Selected = flag1;
                selectListItems5.Add(selectListItem3);
            }
            SelectListItem selectListItem4 = new SelectListItem()
            {
                Text     = "",
                Value    = "",
                Disabled = false
            };

            selectListItems4.Insert(0, selectListItem4);
            this.ViewData["ProductOptions"] = selectListItems4.AsEnumerable <SelectListItem>();
            return(this.PartialView("_CreateOrUpdateSpecificPriceModal", createOrUpdateSpecificPriceModalViewModel));
        }
예제 #24
0
        public async Task <ActionResult> Payeezy(FormCollection formFields)
        {
            int       value;
            string    str;
            Guid      guid;
            string    str1;
            bool      flag;
            PayNowDto payNowDto = new PayNowDto();

            try
            {
                int?impersonatorTenantId = this.AbpSession.ImpersonatorTenantId;
                if (impersonatorTenantId.HasValue)
                {
                    impersonatorTenantId = this.AbpSession.ImpersonatorTenantId;
                    value = impersonatorTenantId.Value;
                }
                else
                {
                    value = this.AbpSession.GetTenantId();
                }
                int num = value;
                TenantSettingsEditDto allSettingsByTenantId = await this._tenantSettingsAppService.GetAllSettingsByTenantId(num);

                long num1 = long.Parse(formFields["invoiceId"]);
                decimal.Parse(formFields["invoiceAmount"]);
                decimal num2    = decimal.Parse(formFields["paymentAmount"]);
                Invoice invoice = await this._invoiceAppService.GetInvoice(num1);

                if (invoice == null || invoice.TenantId != num)
                {
                    if (invoice != null)
                    {
                        throw new Exception("SecurityViolation");
                    }
                    throw new Exception("InvoiceIsNull");
                }
                payNowDto.x_invoice_num = invoice.Number;
                payNowDto.x_po_num      = invoice.PONumber;
                payNowDto.x_reference_3 = invoice.Number;
                ICustomerAppService    customerAppService = this._customerAppService;
                NullableIdInput <long> nullableIdInput    = new NullableIdInput <long>()
                {
                    Id = new long?(invoice.CustomerId)
                };
                GetCustomerForEditOutput customerForEdit = await customerAppService.GetCustomerForEdit(nullableIdInput);

                PayNowDto payNowDto1 = payNowDto;
                string[]  strArrays  = new string[7];
                long      id         = invoice.Id;
                strArrays[0] = id.ToString();
                strArrays[1] = "|";
                long?impersonatorUserId = customerForEdit.Customer.Id;
                id                 = impersonatorUserId.Value;
                strArrays[2]       = id.ToString();
                strArrays[3]       = "|";
                strArrays[4]       = num.ToString();
                strArrays[5]       = "|";
                impersonatorUserId = this.AbpSession.ImpersonatorUserId;
                if (impersonatorUserId.HasValue)
                {
                    impersonatorUserId = this.AbpSession.ImpersonatorUserId;
                    id  = impersonatorUserId.Value;
                    str = id.ToString();
                }
                else
                {
                    impersonatorUserId = this.AbpSession.UserId;
                    if (impersonatorUserId.HasValue)
                    {
                        impersonatorUserId = this.AbpSession.UserId;
                        id  = impersonatorUserId.Value;
                        str = id.ToString();
                    }
                    else
                    {
                        impersonatorUserId = this.AbpSession.UserId;
                        str = impersonatorUserId.ToString();
                    }
                }
                strArrays[6]         = str;
                payNowDto1.x_cust_id = string.Concat(strArrays);
                payNowDto.x_email    = customerForEdit.Customer.Email;
                if (customerForEdit.Customer.BusinessName != null && customerForEdit.Customer.BusinessName.ToString().Length > 0)
                {
                    payNowDto.x_company = customerForEdit.Customer.BusinessName;
                }
                if (customerForEdit.Customer.FirstName != null && customerForEdit.Customer.FirstName.ToString().Length > 0)
                {
                    payNowDto.x_first_name = customerForEdit.Customer.FirstName.ToString();
                }
                if (customerForEdit.Customer.LastName != null && customerForEdit.Customer.LastName.ToString().Length > 0)
                {
                    payNowDto.x_last_name = customerForEdit.Customer.LastName.ToString();
                }
                PayNowDto str2 = payNowDto;
                impersonatorUserId = customerForEdit.Customer.Id;
                id = impersonatorUserId.Value;
                str2.x_customer_tax_id = id.ToString();
                impersonatorUserId     = invoice.CustomerAddressId;
                if (impersonatorUserId.HasValue)
                {
                    impersonatorUserId = invoice.CustomerAddressId;
                    if (impersonatorUserId.Value > (long)0)
                    {
                        IGenericAppService genericAppService = this._genericAppService;
                        GetAddressesInput  getAddressesInput = new GetAddressesInput();
                        impersonatorUserId          = customerForEdit.Customer.Id;
                        getAddressesInput.OwnerId   = new long?(impersonatorUserId.Value);
                        getAddressesInput.OwnerType = "Customer";
                        PagedResultOutput <AddressListDto> addresses = await genericAppService.GetAddresses(getAddressesInput);

                        int num3 = 0;
                        while (num3 < addresses.Items.Count)
                        {
                            long id1 = (long)addresses.Items[num3].Id;
                            impersonatorUserId = invoice.CustomerAddressId;
                            flag = (id1 == impersonatorUserId.GetValueOrDefault() ? impersonatorUserId.HasValue : false);
                            if (!flag)
                            {
                                num3++;
                            }
                            else
                            {
                                payNowDto.x_address  = addresses.Items[num3].PrimaryAddress;
                                payNowDto.x_city     = addresses.Items[num3].City;
                                payNowDto.x_zip      = addresses.Items[num3].PostalCode;
                                impersonatorTenantId = addresses.Items[num3].CountryRegionId;
                                if (!impersonatorTenantId.HasValue)
                                {
                                    break;
                                }
                                IGenericAppService genericAppService1 = this._genericAppService;
                                impersonatorTenantId = addresses.Items[num3].CountryRegionId;
                                int?nullable = new int?(impersonatorTenantId.Value);
                                impersonatorTenantId = null;
                                ListResultOutput <CountryRegionInCountryListDto> countryRegions = genericAppService1.GetCountryRegions(nullable, impersonatorTenantId);
                                if (countryRegions.Items.Count != 1)
                                {
                                    break;
                                }
                                payNowDto.x_state = countryRegions.Items[0].Code;
                                break;
                            }
                        }
                    }
                }
                Tenant byIdAsync = await this._tenantManager.GetByIdAsync(num);

                string tenancyName = byIdAsync.TenancyName;
                string str3        = tenancyName;
                string str4        = tenancyName;
                str4      = str3;
                byIdAsync = await this._tenantManager.FindByTenancyNameAsync(str4);

                string    siteRootAddress = this._webUrlService.GetSiteRootAddress(str4);
                PayNowDto payNowDto2      = payNowDto;
                object[]  objArray        = new object[] { siteRootAddress, "Mpa/Settings/GetLogoById?logoId=", null, null, null };
                guid                            = (allSettingsByTenantId.Logo.InvoiceImageId.HasValue ? allSettingsByTenantId.Logo.InvoiceImageId.Value : Guid.Empty);
                objArray[2]                     = guid;
                objArray[3]                     = "&logoType=header&viewContrast=light&t=";
                id                              = Clock.Now.Ticks;
                objArray[4]                     = id.ToString();
                payNowDto2.x_logo_url           = string.Concat(objArray);
                payNowDto.x_receipt_link_url    = string.Concat(siteRootAddress, "Pay/PayeezyResponse");
                payNowDto.x_receipt_link_method = "AUTO-POST";
                payNowDto.x_receipt_link_text   = this.L("CompleteTransaction");
                if (allSettingsByTenantId.PaymentGatewaySettings.GatewaySettings.Length <= 3)
                {
                    throw new Exception("PaymentGatewayError_PayEezySettingsMissing");
                }
                PayEezyJsonObject payEezyJsonObject = JsonConvert.DeserializeObject <PayEezyJsonObject>(allSettingsByTenantId.PaymentGatewaySettings.GatewaySettings);
                payNowDto.x_login           = payEezyJsonObject.PayEezy_x_login;
                payNowDto.x_transaction_key = payEezyJsonObject.PayEezy_x_transaction_key;
                PayNowDto payNowDto3          = payNowDto;
                bool?     payEezyXTestRequest = payEezyJsonObject.PayEezy_x_test_request;
                payNowDto3.x_test_request = bool.Parse(payEezyXTestRequest.ToString());
                PayNowDto payNowDto4 = payNowDto;
                payEezyXTestRequest         = payEezyJsonObject.PayEezy_x_email_customer;
                payNowDto4.x_email_customer = bool.Parse(payEezyXTestRequest.ToString());
                payNowDto.x_gateway_id      = payEezyJsonObject.PayEezy_x_gateway_id;
                PayNowDto payNowDto5          = payNowDto;
                string    payEezyXDescription = payEezyJsonObject.PayEezy_x_description;
                str1 = (formFields["Description"] == null || formFields["Description"] != null && formFields["Description"].ToString().Length > 0 ? string.Concat(" ", formFields["Description"].ToString()) : "");
                payNowDto5.x_description = string.Concat(payEezyXDescription, str1);
                payNowDto.x_amount       = num2;
                payNowDto.x_customer_ip  = PayController.GetIPAddress(this.Request);
                Random    random = new Random();
                PayNowDto str5   = payNowDto;
                int       num4   = random.Next(0, 1000);
                str5.x_fp_sequence = num4.ToString();
                TimeSpan utcNow = DateTime.UtcNow - new DateTime(1970, 1, 1);
                payNowDto.x_fp_timestamp = ((int)utcNow.TotalSeconds).ToString();
                payNowDto.x_fp_hash      = PayController.GeneratePayeezyHash(payNowDto.x_transaction_key, payNowDto.x_login, payNowDto.x_amount, payNowDto.x_fp_sequence, payNowDto.x_fp_timestamp, "USD");
                if (!payNowDto.x_test_request)
                {
                    payNowDto.PostToUrl = "https://checkout.globalgatewaye4.firstdata.com/payment";
                }
                else
                {
                    payNowDto.PostToUrl = "https://demo.globalgatewaye4.firstdata.com/payment";
                }
                allSettingsByTenantId = null;
                invoice = null;
                str4    = null;
            }
            catch (Exception)
            {
                payNowDto = new PayNowDto();
                ((dynamic)this.ViewBag).Error_InvalidParameters = true;
            }
            return(this.View(payNowDto));
        }