/// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllAsync(DataTableParameter model)
        {
            try
            {
                var query = this.currencyRepository.Table.Include(r => r.PackageCountry).Select(x => new
                                                                                                PackageCurrencyViewModel
                {
                    Id           = x.Id,
                    CountryName  = x.PackageCountry.Name,
                    Code         = x.Code,
                    Country      = x.Country,
                    Symbol       = x.Symbol,
                    Name         = x.Name,
                    ExchangeRate = x.ExchangeRate == null ? 0 : Convert.ToDecimal(x.ExchangeRate),
                    IsActive     = x.IsActive
                });
                var list = await this.currencyViewModelRepository.ToPagedListAsync(query, model);

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllAsync(DataTableParameter model)
        {
            var query   = this.homeBannerRepository.Table;
            var records = await this.homeBannerRepository.ToPagedListAsync(query, model);

            return(records);
        }
        public async Task <IActionResult> LoadItems([FromBody] DataTableParameter obj)
        {
            IQueryable <Item> result = _context.Items.AsQueryable();
            var resultCount          = await _context.Items.CountAsync();

            var searchValue = obj.search?.Value;

            if (!string.IsNullOrWhiteSpace(searchValue))
            {
                result = result.Where(x => x.Name.Contains(searchValue) ||
                                      x.Description.Contains(searchValue));
            }

            var recordsFilteredCount = result.Count();

            //todo: add filtering
            return(Json(new
            {
                draw = obj.draw,
                recordsTotal = resultCount,
                recordsFiltered = recordsFilteredCount,
                data = await result
                       .Skip(obj.start)
                       .Take(obj.length)
                       .ToListAsync()
            }));
        }
Example #4
0
        public static List <UserModel> GetUserList(out int total, DataTableParameter para, string searchValue)
        {
            using (InnovatorSolutionsEntities db = new InnovatorSolutionsEntities())
            {
                IQueryable <UserModel> datas = (from g in db.USER
                                                where g.LOGON_ENABLED == "1" && (g.FIRST_NAME.Contains(searchValue) || g.B_JOBNUMBER.Contains(searchValue) || g.EMAIL.Contains(searchValue) || g.B_CENTRE.Contains(searchValue) || g.B_DEPARTMENT.Contains(searchValue) || g.B_SENIORMANAGER.Contains(searchValue) || g.B_DIRECTOR.Contains(searchValue) || g.B_VP.Contains(searchValue))
                                                select new UserModel()
                {
                    Id = g.ID,
                    first_Name = g.FIRST_NAME,
                    b_JobNumber = g.B_JOBNUMBER,
                    Email = g.EMAIL,
                    b_Centre = g.B_CENTRE,
                    b_Department = g.B_DEPARTMENT,
                    b_SeniorManager = g.B_SENIORMANAGER,
                    b_Director = g.B_DIRECTOR,
                    b_VP = g.B_VP,
                    b_AffiliatedCompany = g.B_AFFILIATEDCOMPANY
                });
                //排序
                if (para.sSortType == "asc")
                {
                    datas = Common.OrderBy(datas, para.iSortTitle, false);
                }
                else
                {
                    datas = Common.OrderBy(datas, para.iSortTitle, true);
                }

                total = datas.Count();
                //分页
                datas = datas.Skip(para.iDisplayStart).Take(para.iDisplayLength);
                return(datas.ToList());
            }
        }
        public JsonResult GetProjectManageList(DataTableParameter para, string searchValue)
        {
            int total    = 0;
            var dataList = GetProjectManageList(Userinfo.Roles, out total, para, searchValue);

            if (dataList != null)
            {
                foreach (var item in dataList)
                {
                    string strHtml   = "<div class='row'><div class='col-md-6'>{0}</div><div class='col-md-6' style='text-align:right'>{1}</div></div>";
                    string linkAList = "<a class='glyphicon glyphicon-pencil edit' title='修改' Id='" + item.id + "'></a>";
                    linkAList += "&nbsp;&nbsp;&nbsp;" + "<a class='glyphicon glyphicon-eye-open detail' title='详情' id='" + item.id + "' ></a>";
                    linkAList += "&nbsp;&nbsp;&nbsp;" + "<a class='glyphicon glyphicon-remove delete' title='删除' id='" + item.id + "' ></a>";
                    strHtml    = string.Format(strHtml, item.b_ProjectRecordNo, linkAList);
                    item.b_ProjectRecordNo = strHtml;
                    item.b_IsInUse         = item.b_IsInUse == "1" ? "是" : "否";
                    if (item.b_PrIsUse != null)
                    {
                        item.b_PrIsUse = item.b_PrIsUse == "1" ? "是" : "否";
                    }
                    item.b_ProjectName = "<div style='width:150px;word-wrap:break-word;'>" + item.b_ProjectName + "</div>";
                }
            }
            return(Json(new
            {
                sEcho = para.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = dataList
            }, JsonRequestBehavior.AllowGet));
        }
 /// <summary>
 /// Gets all asynchronous.
 /// </summary>
 /// <returns>
 /// Get All List
 /// </returns>
 /// <param name="model">Model.</param>
 public async Task <DataTableResult> GetAllVisaMasterAsync(DataTableParameter model)
 {
     try
     {
         var query = from visa in this.visaRespository.Table
                     join country in this.packageCountryRespository.Table on visa.CountryId equals country.Id
                     join vendor in this.vendorRespository.Table on visa.VendorID equals vendor.Id
                     select new VisaMasterGridViewModel
         {
             Id          = visa.Id,
             Vendor      = vendor.Name + ", " + vendor.CityModel.Name + " ," + vendor.CountryModel.Name,
             IsActive    = visa.IsActive,
             AdultPrice  = visa.AdultPrice,
             ChildPrice  = visa.ChildPrice,
             Country     = country.Name,
             CreatedBy   = visa.CreatedBy,
             CreatedDate = visa.CreatedDate,
             UpdatedBy   = visa.UpdatedBy,
             UpdatedDate = visa.UpdatedDate
         };
         return(await this.visaMasterGridRespository.ToPagedListAsync(query, model));
     }
     catch (Exception ex)
     {
         string messege = ex.ToString();
         return(null);
     }
 }
        public JsonResult GetExpenseCategoryList(DataTableParameter para, string searchValue)
        {
            int total    = 0;
            var dataList = GetExpenseCategoryList(out total, para, searchValue);

            if (dataList != null)
            {
                foreach (var item in dataList)
                {
                    string strHtml   = "<div class='row'><div class='col-md-6'>{0}</div><div class='col-md-6' style='text-align:right'>{1}</div></div>";
                    string linkAList = "<a class='glyphicon glyphicon-pencil edit' title='修改' Id='" + item.Id + "'></a>";
                    linkAList      += "&nbsp;&nbsp;&nbsp;" + "<a class='glyphicon glyphicon-eye-open detail' title='详情' id='" + item.Id + "' ></a>";
                    linkAList      += "&nbsp;&nbsp;&nbsp;" + "<a class='glyphicon glyphicon-remove delete' title='删除' id='" + item.Id + "' ></a>";
                    strHtml         = string.Format(strHtml, item.b_CostName, linkAList);
                    item.b_CostName = strHtml;
                }
            }
            return(Json(new
            {
                sEcho = para.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = dataList
            }, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// Get All PaggedList
        /// </returns>
        public async Task <DataTableResult> GetAllAsync(DataTableParameter model)
        {
            var query   = this.userDetailRepository.Table.OrderByDescending(x => x.CreatedDate);
            var records = await this.userDetailRepository.ToPagedListAsync(query, model);

            return(records);
        }
Example #9
0
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="id">Vendor Identifier</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetVendorBankDetailByIdAsync(DataTableParameter model, int id)
        {
            try
            {
                var records = this.vendorBankRepo.Table.Where(x => x.VendorId == id).Select(x => new VendorBankDetailGridViewModel
                {
                    Id            = x.Id,
                    AccountNumber = x.AccountNumber,
                    AccountType   = x.AccountType,
                    BankName      = x.BankName,
                    GST           = x.GST,
                    HolderName    = x.HolderName,
                    IFSCCode      = x.IFSCCode,
                    PAN           = x.PAN,
                    SwiftCode     = x.SwiftCode,
                    IsPrimary     = x.IsPrimary ? "Primary" : string.Empty,
                    CreatedBy     = x.CreatedBy,
                    CreatedDate   = x.CreatedDate,
                    UpdatedBy     = x.UpdatedBy,
                    UpdatedDate   = x.UpdatedDate
                });

                return(await this.vendorBankGrid.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
Example #10
0
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllVendorsAsync(DataTableParameter model)
        {
            try
            {
                var records = this.vendorInformationRepo.Table.Where(x => !x.IsDeleted).Select(x => new VendorGridViewModel
                {
                    Id          = x.Id,
                    Category    = x.CategoryModel.Name,
                    Name        = x.Name,
                    City        = x.CityModel.Name,
                    Country     = x.CountryModel.Name,
                    Group       = x.Group == 0 ? string.Empty : x.VendorGroupModel.Name,
                    IsActive    = x.IsActive,
                    CreatedBy   = x.CreatedBy,
                    CreatedDate = x.CreatedDate,
                    UpdatedBy   = x.UpdatedBy,
                    UpdatedDate = x.UpdatedDate
                });

                return(await this.vendorGridViewModelRepo.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
Example #11
0
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="id">Vendor Identifier</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetVendorContractsByIdAsync(DataTableParameter model, int id)
        {
            try
            {
                var records = this.vendorContractsRepo.Table.Where(x => x.VendorId == id).Select(x => new VendorContractGridViewModel
                {
                    Id          = x.Id,
                    EndDate     = x.EndDate,
                    StartDate   = x.StartDate,
                    MarginType  = x.MarginTypeModel.Name,
                    MarginValue = x.MarginValue.ToString(),
                    CreatedBy   = x.CreatedBy,
                    CreatedDate = x.CreatedDate,
                    UpdatedBy   = x.UpdatedBy,
                    UpdatedDate = x.UpdatedDate
                });

                return(await this.vendorContractGrid.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
Example #12
0
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="id">Vendor Identifier</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetVendorContactsByIdAsync(DataTableParameter model, int id)
        {
            try
            {
                var records = this.vendorContactsRepo.Table.Where(x => x.VendorId == id).Select(x => new VendorContactGridViewModel
                {
                    Id          = x.Id,
                    FullName    = x.Salutation + " " + x.FirstName + " " + x.LastName,
                    Email       = x.Email,
                    Designation = x.Designation,
                    Mobile      = x.Mobile,
                    WorkPhone   = x.WorkPhone,
                    Primary     = x.IsPrimary ? "Yes" : "No",
                    CreatedBy   = x.CreatedBy,
                    CreatedDate = x.CreatedDate,
                    UpdatedBy   = x.UpdatedBy,
                    UpdatedDate = x.UpdatedDate
                });

                return(await this.vendorContactGrid.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
Example #13
0
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllVendorGroupsAsync(DataTableParameter model)
        {
            try
            {
                var records = this.vendorGroupRepo.Table.Where(x => !x.IsDeleted).Select(x => new VendorGroupGridViewModel
                {
                    Id            = x.Id,
                    Name          = x.Name,
                    Address       = x.AddressLine1 + ", " + x.AddressLine2 + ", " + this.cityRepo.Table.Where(y => y.Id == x.CityId).Select(y => y.Name).FirstOrDefault() + ", " + this.countryRepo.Table.Where(y => y.Id == x.CountryId).Select(y => y.Name).FirstOrDefault(),
                    Email         = x.EmailId,
                    WorkPhone     = x.WorkPhone,
                    IsActive      = x.IsActive,
                    CreatedBy     = x.CreatedBy,
                    CreatedDate   = x.CreatedDate,
                    UpdatedBy     = x.UpdatedBy,
                    UpdatedDate   = x.UpdatedDate,
                    ContactPerson = x.Salutation + " " + x.FName + " " + x.LName
                });

                return(await this.vendorGroupGridRepo.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="packageId">The Package Id</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetRatePlanAsync(DataTableParameter model, Guid packageId)
        {
            var query = this.ratePlanRepository.Table.Where(x => x.RoomConfigModel.PR_PackageId == packageId && !x.RP_IsDeleted).Select(x => new RatePlanGridViewModel
            {
                RoomName            = x.RoomConfigModel.RoomTypeModel.Name,
                RP_BookingEndDate   = x.RP_BookingEndDate,
                RP_BookingStartDate = x.RP_BookingStartDate,
                RP_ExtraAdultPrice  = x.RP_ExtraAdultPrice,
                RP_ExtraChildPrice  = x.RP_ExtraChildPrice,
                RP_ExtraInfantPrice = x.RP_ExtraInfantPrice,
                RP_FakePrice        = x.RP_FakePrice,
                RP_Id              = x.RP_Id,
                RP_IsActive        = x.RP_IsActive,
                RP_IsDeleted       = x.RP_IsDeleted,
                RP_Name            = x.RP_Name,
                RP_RoomConfigId    = x.RP_RoomConfigId,
                RP_SellingPrice    = x.RP_SellingPrice,
                UpdatedBy          = x.UpdatedBy,
                UpdatedDate        = x.UpdatedDate,
                CreatedBy          = x.CreatedBy,
                CreatedDate        = x.CreatedDate,
                RP_TravelEndDate   = x.RP_TravelEndDate,
                RP_TravelStartDate = x.RP_TravelStartDate
            });

            return(await this.ratePlanGridModel.ToPagedListAsync(query, model));
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllAsync(DataTableParameter model)
        {
            var query   = this.categoryRepository.Table.Where(x => !x.IsDelete);
            var records = await this.categoryRepository.ToPagedListAsync(query, model);

            return(records);
        }
Example #16
0
        public ActionResult InitDataTable(DataTableParameter param)
        {
            var query = _roleService.GetAllRole(param.iDisplayStart / param.iDisplayLength, param.iDisplayLength);

            var filterResult = query.Select(t => new RoleListModel
            {
                Id         = t.Id,
                Name       = t.Name,
                SystemName = t.SystemName,
                Active     = t.Active
            });

            int sortId = param.iDisplayStart + 1;
            var result = from t in filterResult
                         select new[]
            {
                sortId++.ToString(),
                t.Name,
                t.SystemName,
                t.Active.ToString(),
                t.Id.ToString()
            };

            return(DataTableJsonResult(param.sEcho, param.iDisplayStart, query.TotalCount, query.TotalCount, result));
        }
Example #17
0
 /// <summary>
 /// Gets all asynchronous.
 /// </summary>
 /// <returns>
 /// Get All List
 /// </returns>
 /// <param name="model">Model.</param>
 public async Task <DataTableResult> GetAllInsuranceMasterAsync(DataTableParameter model)
 {
     try
     {
         var query = from insurance in this.insuranceRespository.Table
                     join vendor in this.vendorRespository.Table on insurance.VendorID equals vendor.Id
                     select new InsuranceMasterGridViewModel
         {
             Id          = insurance.Id,
             Vendor      = vendor.Name + ", " + vendor.CityModel.Name + " ," + vendor.CountryModel.Name,
             IsActive    = insurance.IsActive,
             AdultPrice  = insurance.AdultRate,
             ChildPrice  = insurance.ChildRate,
             Days        = insurance.Days,
             CreatedBy   = insurance.CreatedBy,
             CreatedDate = insurance.CreatedDate,
             UpdatedBy   = insurance.UpdatedBy,
             UpdatedDate = insurance.UpdatedDate
         };
         return(await this.insuranceMasterGridRespository.ToPagedListAsync(query, model));
     }
     catch (Exception ex)
     {
         string messege = ex.ToString();
         return(null);
     }
 }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="packageId">The Package Id</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetPackageInventoryAsync(DataTableParameter model, Guid packageId)
        {
            var query = this.roomInventoryRepository.Table.Where(x => x.RoomConfigModel.PR_PackageId == packageId && !x.RI_IsDeleted).Select(x => new RoomInventoryGridViewModel
            {
                RoomName           = x.RoomConfigModel.RoomTypeModel.Name,
                RI_BaseRate        = x.RI_BaseRate,
                RI_ExtraAdultCost  = x.RI_ExtraAdultCost,
                RI_ExtraChildCost  = x.RI_ExtraChildCost,
                RI_ExtraInfantCost = x.RI_ExtraInfantCost,
                RI_Id           = x.RI_Id,
                RI_Inventory    = x.RI_Inventory,
                RI_IsActive     = x.RI_IsActive,
                RI_IsDeleted    = x.RI_IsDeleted,
                RI_RoomConfigId = x.RI_RoomConfigId,
                RI_SurgeRate    = x.RI_SurgeRate,
                RI_EndDate      = x.RI_EndDate,
                RI_StartDate    = x.RI_StartDate,
                UpdatedBy       = x.UpdatedBy,
                UpdatedDate     = x.UpdatedDate,
                CreatedBy       = x.CreatedBy,
                CreatedDate     = x.CreatedDate,
            });

            return(await this.roomInventoryGridModel.ToPagedListAsync(query, model));
        }
        public ActionResult List(DataTableParameter param)
        {
            string columns = Request["sColumns"];
            string sortCol = Request["iSortCol_0"];
            string sortDir = Request["sSortDir_0"];

            int sortId = param.iDisplayStart + 1;

            List <INFOR_CATEGORIESModel> list = GetInforCategoryNode("");
            int total  = list.Count;
            var result = from c in list.Skip(param.iDisplayStart).Take(param.iDisplayLength)
                         select new[]
            {
                sortId++.ToString(),
                c.InforCategoryName,
                c.DisplayOrder.ToString(),
                c.ParentName,
                c.Clevel.ToString(),
                CommonHelper.GetEnableStatusString(c.Status),
                c.ID,
            };

            return(Json(new
            {
                sEcho = param.sEcho,
                iDisplayStart = param.iDisplayStart,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = result
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult InitDataTable(DataTableParameter param)
        {
            var query = _permissionService.GetAllPermission(param.iDisplayStart / param.iDisplayLength, param.iDisplayLength);

            var filterResult = query.Select(t =>
            {
                var permission = new PermissionListModel
                {
                    Id           = t.Id,
                    Icon         = !string.IsNullOrEmpty(t.Icon) ? string.Format("<i class=\"fa {0}\"></i>", t.Icon) : "",
                    Name         = t.Name,
                    BreadCrumb   = _permissionService.GetFormattedBreadCrumb(t),
                    LinkUrl      = string.IsNullOrEmpty(t.Controller) ? "#" : string.Format("{0}/{1}/{2}", t.Area, t.Controller, t.Action),
                    DisplayOrder = _permissionService.GetFormattedDisplayOrder(t),
                    Active       = t.Active
                };
                return(permission);
            });

            int sortId = param.iDisplayStart + 1;
            var result = from t in filterResult
                         select new[]
            {
                sortId++.ToString(),
                t.Icon,
                t.Name,
                t.BreadCrumb,
                t.LinkUrl,
                t.DisplayOrder,
                t.Active.ToString(),
                t.Id.ToString()
            };

            return(DataTableJsonResult(param.sEcho, param.iDisplayStart, query.TotalCount, query.TotalCount, result));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BlogService" /> class.
        /// </summary>
        /// <param name="model">Data Table</param>
        /// <param name="mode">Curation Mode</param>
        /// <returns>A <see cref="Task"/> Returns Result </returns>
        public async Task <DataTableResult> GetAllBlogsAsync(DataTableParameter model, string mode)
        {
            var result = this.blogRepository.Table.Select(x => new BlogPostGridViewModel
            {
                Id          = x.Id,
                Image       = x.Image,
                Line1       = x.Line1,
                Line2       = x.Line2,
                Line3       = x.Line3,
                CreatedBy   = x.CreatedBy,
                CreatedDate = x.CreatedDate,
                IsActive    = x.IsActive,
                IsFeatured  = x.IsFeatured,
                UpdatedBy   = x.UpdatedBy,
                UpdatedDate = x.UpdatedDate,
                Url         = x.Url
            });

            if (mode == "feature")
            {
                result = result.Where(x => x.IsFeatured);
            }

            if (mode == "sub")
            {
                result = result.Where(x => !x.IsFeatured);
            }

            return(await this.blogGridModelRepository.ToPagedListAsync(result, model));
        }
        public ActionResult InitDataTable(DataTableParameter param)
        {
            var query = _categoryService.GetAllCategory(param.iDisplayStart / param.iDisplayLength, param.iDisplayLength);

            var filterResult = query.Select(t =>
            {
                var category = new CategoryListModel
                {
                    Id            = t.Id,
                    Name          = _categoryService.GetFormattedBreadCrumb(t),
                    Published     = t.Published,
                    DisplayOrder  = t.DisplayOrder,
                    CreatedOnDate = t.CreatedOnDate
                };
                return(category);
            });

            int sortId = param.iDisplayStart + 1;
            var result = from t in filterResult
                         select new[]
            {
                sortId++.ToString(),
                t.Name,
                t.DisplayOrder.ToString(),
                t.Published.ToString(),
                t.Id.ToString()
            };

            return(DataTableJsonResult(param.sEcho, param.iDisplayStart, query.TotalCount, query.TotalCount, result));
        }
        /// <summary>
        /// 获取审核配置列表
        /// </summary>
        /// <param name="para"></param>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        public JsonResult GetAuditConfigurationList(DataTableParameter para, string searchValue)
        {
            int total    = 0;
            var dataList = GetAuditConfigurationList(out total, para, searchValue);

            if (dataList != null)
            {
                foreach (var item in dataList)
                {
                    item.b_Type = item.b_Type == "Project" ? "项目" : "非项目";
                    string strHtml   = "<div class='row'><div class='col-md-6'>{0}</div><div class='col-md-6' style='text-align:right'>{1}</div></div>";
                    string linkAList = "<a class='glyphicon glyphicon-pencil edit' title='修改' Id='" + item.Id + "'></a>";
                    linkAList         += "&nbsp;&nbsp;&nbsp;" + "<a class='glyphicon glyphicon-eye-open detail' title='详情' id='" + item.Id + "' ></a>";
                    linkAList         += "&nbsp;&nbsp;&nbsp;" + "<a class='glyphicon glyphicon-remove delete' title='删除' id='" + item.Id + "' ></a>";
                    strHtml            = string.Format(strHtml, item.b_RoleName, linkAList);
                    item.b_RoleName    = strHtml;
                    item.b_CostCenters = "<div style='width:200px;word-wrap:break-word;'>" + item.b_CostCenters + "</div>";
                }
            }
            return(Json(new
            {
                sEcho = para.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = dataList
            }, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="hotelId">Hotel Id</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllHotelReviewsByHotelId(DataTableParameter model, int hotelId)
        {
            try
            {
                var records = this.hotelierReviewRepo.Table.Where(x => x.HotelId == hotelId).Select(x => new HotelierReviewsGridViewModel
                {
                    Id                 = x.Id,
                    HotelId            = x.HotelId,
                    Comment            = x.Comment,
                    FullName           = x.FName + " " + x.LName,
                    Rating             = x.Rating,
                    Rating_Cleanliness = x.Rating_Cleanliness,
                    Rating_Comfort     = x.Rating_Comfort,
                    Rating_Location    = x.Rating_Location,
                    Rating_Value       = x.Rating_Value,
                    UserRecommend      = x.UserRecommend ? "Yes" : string.Empty,
                    IsActive           = x.IsActive,
                    CreatedBy          = x.CreatedBy,
                    CreatedDate        = x.CreatedDate,
                    UpdatedBy          = x.UpdatedBy,
                    UpdatedDate        = x.UpdatedDate
                });

                return(await this.hotelierReviewGridModelRepo.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="hotelId">Hotel Id</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetHotelierRoomCofigGrid(DataTableParameter model, int hotelId)
        {
            try
            {
                var records = this.hotelierRoomConfigRepo.Table.Where(x => x.HotelId == hotelId).Select(x => new HotelierRoomConfigGridViewModel
                {
                    Id          = x.Id,
                    Adult       = x.Adult,
                    Child       = x.Child,
                    FreeChild   = x.FreeChild,
                    FreeInfant  = x.FreeInfant,
                    HotelId     = x.HotelId,
                    Infant      = x.Infant,
                    Max         = x.Max,
                    RoomType    = x.PackageHotelRoomTypeModel.Name,
                    IsActive    = x.IsActive,
                    CreatedBy   = x.CreatedBy,
                    CreatedDate = x.CreatedDate,
                    UpdatedBy   = x.UpdatedBy,
                    UpdatedDate = x.UpdatedDate
                });

                return(await this.hotelierRoomConfigGridRepo.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetHotelsAsync(DataTableParameter model)
        {
            try
            {
                var records = this.hotelierInformationRepo.Table.Where(x => !x.IsDeleted).Select(x => new HotelierGridViewModel
                {
                    VendorId     = x.VendorInformationModel.Id,
                    Id           = x.Id,
                    Name         = x.Name,
                    PropertyType = x.HotelierPropertyTypeModel.Name,
                    StarRating   = x.StarRating.ToString(),
                    ////AmenitiesCount = x.HotelierInformationModels.Count > 0 ? x.HotelierInformationModels.FirstOrDefault().HotelierAmenitiesModels.Count : 0,
                    Group            = x.VendorInformationModel.VendorGroupModel.Name,
                    Area             = x.Area.ToString(),
                    City             = x.City != null && x.City != 0 ? this.packageCityRespository.Table.Where(y => y.Id == x.City).Select(y => y.Name).FirstOrDefault() : string.Empty,
                    State            = x.State == null || x.State == 0 ? string.Empty : this.packageStateRespository.Table.Where(y => y.Id == x.State).Select(y => y.Name).FirstOrDefault(),
                    Country          = x.Country != null && x.Country != 0 ? this.packageCountryRespository.Table.Where(y => y.Id == x.Country).Select(y => y.Name).FirstOrDefault() : string.Empty,
                    FormattedAddress = x.Address1 + ", " + x.Address2 + ", " + x.City != null && x.City != 0 ? this.packageCityRespository.Table.Where(y => y.Id == x.City).Select(y => y.Name).FirstOrDefault() : string.Empty + x.Country != null && x.Country != 0 ? this.packageCountryRespository.Table.Where(y => y.Id == x.Country).Select(y => y.Name).FirstOrDefault() : string.Empty,
                    PrimaryContactId = x.VendorInformationModel.VendorContactModels.Where(y => y.IsPrimary == true).Select(y => y.Id).FirstOrDefault(),
                    PrimaryContact   = x.VendorInformationModel.VendorContactModels.Where(y => y.IsPrimary == true).Select(y => y.Salutation).FirstOrDefault() + " " + x.VendorInformationModel.VendorContactModels.Where(y => y.IsPrimary == true).Select(y => y.FirstName).FirstOrDefault() + " " + x.VendorInformationModel.VendorContactModels.Where(y => y.IsPrimary == true).Select(y => y.LastName).FirstOrDefault(),
                    IsActive         = x.IsActive,
                    CreatedBy        = x.CreatedBy,
                    CreatedDate      = x.CreatedDate,
                    UpdatedBy        = x.UpdatedBy,
                    UpdatedDate      = x.UpdatedDate,
                });

                return(await this.hotelierGridRepo.ToPagedListAsync(records, model));
            }
            catch (Exception ex)
            {
                string msg = ex.ToString();
                return(null);
            }
        }
Example #27
0
        private DataTableParameter MapParameterModel(HttpContext httpContext)
        {
            var request = httpContext.Request.Form;

            int draw   = Convert.ToInt32(request["draw"]);
            int start  = Convert.ToInt32(request["start"]);
            int length = Convert.ToInt32(request["length"]);

            var search = new DataTableSearch
            {
                Value = request["search[value]"],
                Regex = Convert.ToBoolean(request["search[regex]"])
            };

            var o     = 0;
            var order = new List <DataTableOrder>();

            while (request["order[" + o + "][column]"].Count > 0)
            {
                order.Add(new DataTableOrder()
                {
                    Column = Convert.ToInt32(request["order[0][column]"].ToList()[0]),
                    Dir    = request["order[" + o + "][dir]"]
                });
                o++;
            }

            // Columns
            var c       = 0;
            var columns = new List <DataTableColumn>();

            while (request["columns[" + c + "][name]"].Count > 0)
            {
                columns.Add(new DataTableColumn
                {
                    Data      = request["columns[" + c + "][data]"][0],
                    Name      = request["columns[" + c + "][name]"][0],
                    Orderable = Convert.ToBoolean(request["columns[" + c + "][orderable]"][0]),
                    Search    = new DataTableSearch
                    {
                        Value = request["columns[" + c + "][search][value]"][0],
                        Regex = Convert.ToBoolean(request["columns[" + c + "][search][regex]"][0])
                    }
                });
                c++;
            }

            var mapData = new DataTableParameter
            {
                Draw    = draw,
                Start   = start,
                Length  = length,
                Search  = search,
                Order   = order,
                Columns = columns,
            };

            return(mapData);
        }
        /// <summary>
        /// Gets all asynchronous.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>
        /// GetAllAsync
        /// </returns>
        public async Task <DataTableResult> GetAllAsync(DataTableParameter model)
        {
            var query = from ct in this.cityRepository.Table
                        select ct;
            var list = await this.cityRepository.ToPagedListAsync(query, model);

            return(list);
        }
        public static DataTableParameter GetDataTableParameter(this ControllerBase controllerBase)
        {
            var dataTableParameter = new DataTableParameter();

            dataTableParameter.Filter    = controllerBase.ControllerContext.HttpContext.Request.Query["filter"];
            dataTableParameter.Orderby   = controllerBase.ControllerContext.HttpContext.Request.Query["orderby"];
            dataTableParameter.PageSize  = int.Parse(controllerBase.ControllerContext.HttpContext.Request.Query["pageSize"]);
            dataTableParameter.PageIndex = int.Parse(controllerBase.ControllerContext.HttpContext.Request.Query["pageIndex"]);
            return(dataTableParameter);
        }
Example #30
0
        /// <summary>
        /// Indexes the specified model.
        /// </summary>
        /// <param name="model">Model Data Table</param>
        /// <returns>View</returns>
        public IActionResult Recommendations([ModelBinder(typeof(DataTableModelBinder))] DataTableParameter model)
        {
            if (this.IsAjaxRequest())
            {
                ////var result = await this.homePageService.GetAllSpecialDealsAsync(model);
                return(this.Json(new object { }));
            }

            return(this.View());
        }