示例#1
0
        public async Task <JsonResult> GetList(int iDisplayStart, int iDisplayLength, string sSearch, int iColumns, int iSortingCols, int iSortCol_0, string sSortDir_0, int sEcho)
        {
            List <Personal> cacheModel;

            if (!_memoryCache.TryGetValue(_personalCacheKey, out cacheModel))
            {
                var   lists = _personal.GetList(x => !x.IsDelete);
                await lists;
                cacheModel = lists.Result;
                var opts = new MemoryCacheEntryOptions()
                {
                    SlidingExpiration = TimeSpan.FromMinutes(5)
                };
                _memoryCache.Set(_personalCacheKey, cacheModel, opts);
            }


            List <Personal> list = cacheModel;

            var filteredlist =
                list
                .Select(x => new[] {
                x.PersonalId.ToString(),
                x.Adi,
                x.Soyadi,
                x.SahisNo,
                x.AileNo,
                x.AnaAdi,
                x.BabaAdi,
                Buttons(x.PersonalId, x.IsState)
            }).Where(x => string.IsNullOrEmpty(sSearch) || x.Any(y => y.IndexOf(sSearch, StringComparison.CurrentCultureIgnoreCase) >= 0));

            var enumerable = filteredlist as string[][] ?? filteredlist.ToArray();

            filteredlist = sSortDir_0 == "desc" ? enumerable.OrderByDescending(x => (x[iSortCol_0])) : enumerable.OrderBy(x => (x[iSortCol_0]));

            filteredlist = filteredlist
                           .Skip(iDisplayStart)
                           .Take(iDisplayLength);

            var orderedlist = filteredlist;
            var model       = new
            {
                aaData = orderedlist,
                iTotalDisplayRecords = enumerable.Length,
                iTotalRecords        = list.Count(),
                sEcho = sEcho.ToString()
            };

            return(Json(model));
        }
示例#2
0
        private async void Border_MouseDownAsync(object sender, MouseButtonEventArgs e)
        {
            Border b = sender as Border;

            if (b.Name == "GeriBorder")
            {
                await this.AnimateOut();

                this.NavigationService.Navigate(new MainMenuPage());
            }
            else if (b.Name == "PersonelDokumAlBorder")
            {
                IPersonalService   personalService   = IocUtil.Resolve <IPersonalService>();
                IDepartmentService departmentService = IocUtil.Resolve <IDepartmentService>();
                Department         department        = departmentService.Get(Convert.ToInt32(DepartmanComboBox.SelectedValue));
                var report = new Report(personalService.GetList().Where(x => x.DepartmentId == department.Id).ToReportSource(), new PdfReportWriter());
                report.TextFields.Title    = "Personel Dökümü";
                report.TextFields.SubTitle = department.Name + " Personelleri";
                using (Stream stream = File.Create(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\personel-dokum.pdf"))
                {
                    report.WriteReport(stream);
                }
                System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\personel-dokum.pdf");
            }
            else if (b.Name == "UrunDokumAlBorder")
            {
                IPersonalService  personalService  = IocUtil.Resolve <IPersonalService>();
                IWarehouseService warehouseService = IocUtil.Resolve <IWarehouseService>();

                Personal personal = PersonellerDataGrid.SelectedItem as Personal;

                var report = new Report(warehouseService.GetProducts().Where(x => x.AssignedById == personal.Id).ToReportSource(), new PdfReportWriter());

                report.TextFields.Title = "Ürün Dökümü";

                report.TextFields.SubTitle = personal.Name + " " + personal.LastName + " Ürünleri";

                using (Stream stream = File.Create(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\urun-dokum.pdf"))
                {
                    report.WriteReport(stream);
                }
                System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\urun-dokum.pdf");
            }
        }
示例#3
0
        private void fillPersonalDataGrid(int id)
        {
            IPersonalService personalService = IocUtil.Resolve <IPersonalService>();

            PersonellerDataGrid.ItemsSource = personalService.GetList().Where(x => x.DepartmentId == id && x.Id != department.ManagerId);
        }
示例#4
0
        public async Task <JsonResult> GetList(int iDisplayStart, int iDisplayLength, string sSearch, int iColumns, int iSortingCols, int iSortCol_0, string sSortDir_0, int sEcho)
        {
            //sSearch = sSearch.ToUpper();
            object cacheKey = "PersonalList_CacheKey";

            List <Personal> cacheModel;

            //if (_memoryCache.TryGetValue(cacheKey, out cacheModel))
            //{
            //    var lists = _personal.GetList(x => !x.IsDelete);
            //    await lists;
            //    cacheModel = lists.Result;
            //    var opts = new MemoryCacheEntryOptions()
            //   {
            //      SlidingExpiration = TimeSpan.FromMinutes(30)
            //    };
            //    _memoryCache.Set(cacheKey, cacheModel, opts);
            //}
            if (!_memoryCache.TryGetValue(cacheKey, out cacheModel))
            {
                var   lists = _personal.GetList(x => !x.IsDelete);
                await lists;
                cacheModel = lists.Result;
                var opts = new MemoryCacheEntryOptions()
                {
                    SlidingExpiration = TimeSpan.FromMinutes(30)
                };
                _memoryCache.Set(cacheKey, cacheModel, opts);
            }
            //var cacheEntry = await
            //    _memoryCache.GetOrCreateAsync(cacheKey, entry =>
            //    {
            //        entry.SlidingExpiration = TimeSpan.FromSeconds(3);
            //        var lists = _personal.GetList(x => !x.IsDelete);

            //        return Task.FromResult(lists);
            //    });

            List <Personal> list = cacheModel;

            var filteredlist =
                list
                .Select(x => new[] {
                x.PersonalId.ToString(),
                x.Adi,
                x.Soyadi,
                x.SahisNo,
                x.AileNo,
                x.AnaAdi,
                x.BabaAdi,
                Buttons(x.PersonalId, x.IsState)
            }).Where(x => string.IsNullOrEmpty(sSearch) || x.Any(y => y.IndexOf(sSearch, StringComparison.CurrentCultureIgnoreCase) >= 0));

            var enumerable = filteredlist as string[][] ?? filteredlist.ToArray();

            if (sSortDir_0 == "desc")
            {
                filteredlist = enumerable.OrderByDescending(x => (x[iSortCol_0]));

                //.OrderByOrdinal(x => (x[iSortCol_0]).Parse(), sSortDir_0 == "desc")
            }
            else
            {
                filteredlist = enumerable.OrderBy(x => (x[iSortCol_0]));
            }

            filteredlist = filteredlist
                           .Skip(iDisplayStart)
                           .Take(iDisplayLength);

            var orderedlist = filteredlist;
            var model       = new
            {
                aaData = orderedlist,
                iTotalDisplayRecords = enumerable.Length,
                iTotalRecords        = list.Count(),
                sEcho = sEcho.ToString()
            };

            return(Json(model));
        }