예제 #1
0
 private void UstawRok()
 {
     DateOd           = new DateTime(DateTime.Today.Year, 1, 1);
     DateDo           = new DateTime(DateTime.Today.Year, 12, 31);
     _listadokumentow = context.IHP_NAGLDOK.Where(x => x.DATADOK >= DateOd && x.DATADOK <= DateDo).OrderByDescending(x => x.DATAWPISU).ToList();
     Dokumenty.Clear();
     foreach (IHP_NAGLDOK item in _listadokumentow)
     {
         Dokumenty.Add(item);
     }
     KasujKolory();
     //KolorRok  = Color.FromRgb(135, 206, 250);
     wybierzrok = true;
     KolorRok   = (Color)ColorConverter.ConvertFromString("#FFCADBF3");
 }
예제 #2
0
        private void Flitr()
        {
            if (KontrahArch != null)
            {
                _listadokumentow = context.IHP_NAGLDOK.Where(x => x.DATADOK >= DateOd && x.DATADOK <= DateDo && x.ID_IHP_KONTRAHENT_ARCH.Equals(KontrahArch.ID_IHP_KONTRAHENT_ARCH)).OrderByDescending(x => x.DATAWPISU).ToList();
            }
            else
            {
                _listadokumentow = context.IHP_NAGLDOK.Where(x => x.DATADOK >= DateOd && x.DATADOK <= DateDo).OrderByDescending(x => x.DATAWPISU).ToList();
            }

            Dokumenty.Clear();
            foreach (IHP_NAGLDOK item in _listadokumentow)
            {
                Dokumenty.Add(item);
            }
        }
예제 #3
0
        public ActionResult Edit()
        {
            Dokumenty dataBase = repository.Dokumentys.FirstOrDefault();

            if (dataBase == null)
            {
                dataBase = new Dokumenty
                {
                    Tresc = "Wpisz tutaj treść."
                };
                repository.SaveDokumenty(dataBase);
            }
            ViewBag.fileList = Directory
                               .EnumerateFiles(fileDirectory, "*", SearchOption.AllDirectories)
                               .Select(Path.GetFileName);
            ViewBag.fileDirectory = fileDirectory;
            return(View(dataBase));
        }
예제 #4
0
        private void UstawDzien()
        {
            DateTime currentDateTime = DateTime.Now;

            DateOd           = currentDateTime.Date;
            DateDo           = currentDateTime.Date.AddDays(1).AddTicks(-1);
            _listadokumentow = context.IHP_NAGLDOK.Where(x => x.DATADOK >= DateOd && x.DATADOK <= DateDo).OrderByDescending(x => x.DATAWPISU).ToList();

            Dokumenty.Clear();

            foreach (IHP_NAGLDOK item in _listadokumentow)
            {
                Dokumenty.Add(item);
            }
            KasujKolory();
            wybierzdzien = true;
            //KolorDzien  = Color.FromRgb(135, 206, 250);
            KolorDzien = (Color)ColorConverter.ConvertFromString("#FFCADBF3");
        }
예제 #5
0
        private void UstawTydzien()
        {
            DayOfWeek fdow   = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
            int       offset = fdow - DateTime.Today.DayOfWeek - 1;

            DateOd           = DateTime.Today.AddDays(offset);
            DateDo           = DateOd.AddDays(7);
            _listadokumentow = context.IHP_NAGLDOK.Where(x => x.DATADOK >= DateOd && x.DATADOK <= DateDo).OrderByDescending(x => x.DATAWPISU).ToList();

            Dokumenty.Clear();

            foreach (IHP_NAGLDOK item in _listadokumentow)
            {
                Dokumenty.Add(item);
            }
            KasujKolory();
            wybierztydzien = true;
            //KolorTydzien  = Color.FromRgb(135, 206, 250);
            KolorTydzien = (Color)ColorConverter.ConvertFromString("#FFCADBF3");
        }
예제 #6
0
        public ActionResult DeleteFile(string file)
        {
            ViewBag.fileList = Directory
                               .EnumerateFiles(fileDirectory, "*", SearchOption.AllDirectories)
                               .Select(Path.GetFileName);
            ViewBag.fileDirectory = fileDirectory;
            var fileName = "";

            fileName = file;
            var fullPath = Path.Combine(fileDirectory, file);

            if (System.IO.File.Exists(fullPath))
            {
                System.IO.File.Delete(fullPath);
                ViewBag.deleteSuccess = "true";
            }
            Dokumenty dataBase = repository.Dokumentys.FirstOrDefault();

            return(View("Edit", dataBase));
        }
예제 #7
0
        public async Task <IActionResult> Edit(Dokumenty modelReturned, List <IFormFile> files)
        {
            Dokumenty dataBase = repository.Dokumentys.FirstOrDefault();

            dataBase.Tresc = HtmlUtility.RemoveInvalidHtmlTags(modelReturned.Tresc);
            repository.SaveDokumenty(dataBase);
            if (files != null)
            {
                long size     = files.Sum(f => f.Length);
                var  filePath = "";
                foreach (var formFile in files)
                {
                    filePath = Path.Combine(fileDirectory, formFile.FileName);
                    if (formFile.Length > 0)
                    {
                        using (var stream = new FileStream(filePath, FileMode.Create))
                        {
                            await formFile.CopyToAsync(stream);
                        }
                    }
                }
            }
            return(RedirectToAction(nameof(Index)));
        }