public ActionResult Done(int id)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Islem islem = db.Islem.Find(id);

            if (islem == null)
            {
                return(HttpNotFound());
            }
            var cari = db.Cari.Find(islem.Cari_ID);

            ViewBag.CariBilgisi = cari.Cari_AdSoyad;

            var arac = db.viewAracList.First(x => x.Arac_ID == islem.Arac_ID);

            ViewBag.AracBilgisi = arac.AracMarka_Adi + " " + arac.AracModel_Adi + " (" + arac.AracPlakaNo + ")";

            ViewBag.IslemId = islem.Islem_ID;
            DoneViewModel model = new DoneViewModel
            {
                Islem_TahsilEdilen = islem.Islem_KalanBorc,
                Tahsilat_Aciklama  = "Kiralama tamamlanırken tahsil edildi.",
            };

            return(View(model));
        }
        public ActionResult Done(DoneViewModel model, int id)
        {
            Islem islem = db.Islem.Find(id);

            if (ModelState.IsValid)
            {
                islem.Islem_TahsilEdilen         += model.Islem_TahsilEdilen ?? 0;
                islem.Islem_KalanBorc            -= model.Islem_TahsilEdilen ?? 0;
                islem.Islem_ToplamDigerUcretler   = model.Islem_ToplamDigerUcretler;
                islem.Islem_ToplamEkstraHizmetler = model.Islem_ToplamEkstraHizmetler;
                islem.Islem_ToplamKiralamaUcreti  = model.Islem_ToplamKiralamaUcreti;
                islem.Islem_ToplamKMAsimUcreti    = model.Islem_ToplamKMAsimUcreti;
                islem.Islem_ToplamValeHizmetleri  = model.Islem_ToplamValeHizmetleri;


                var truncated = $"{islem.Islem_ID} Id'li İşlem: {model.Tahsilat_Aciklama}";
                if (truncated.Length > 500)
                {
                    truncated = truncated.Substring(0, 500);
                }
                KasaIslem tahsilat = new KasaIslem
                {
                    KasaIslem_Aciklama   = truncated,
                    KasaIslem_CreateDate = DateTime.Now,
                    KasaIslem_Tarih      = DateTime.Now,
                    KasaIslem_Tutar      = model.Islem_TahsilEdilen ?? 0,
                    OdemeTipi_ID         = (int)model.OdemeTipi_ID,
                    KasaIslem_Tipi       = (int)KasaIslemTipi.Gelir
                };
                db.KasaIslem.Add(tahsilat);
                islem.Islem_Tipi = (int)IslemTipi.Tamamlandi;


                Arac a = db.Arac.Find(islem.Arac_ID);
                a.AracKiralamaDurumu = (int)AracDurumu.Bos;
                a.AracGuncelKM       = (double)model.Islem_SonKM;

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            var cari = db.Cari.Find(islem.Cari_ID);

            ViewBag.CariBilgisi = cari.Cari_AdSoyad;

            var arac = db.viewAracList.First(x => x.Arac_ID == islem.Arac_ID);

            ViewBag.AracBilgisi = arac.AracMarka_Adi + " " + arac.AracModel_Adi + " (" + arac.AracPlakaNo + ")";

            ViewBag.IslemId = islem.Islem_ID;

            return(View(model));
        }
Exemple #3
0
        public async Task <bool> AssignDone(string projectId, DoneViewModel model)
        {
            StringContent modelJson = new StringContent(JsonSerializer.Serialize(model), Encoding.UTF8, "application/json");
            var           response  = await httpClient.PutAsync($"api/MongoProject/api/v1/project/AssignDone/{projectId}", modelJson);

            if (response.IsSuccessStatusCode)
            {
                var result = await JsonSerializer.DeserializeAsync <DoneViewModel>(await response.Content.ReadAsStreamAsync());

                return(true);
            }
            return(false);
        }
        public async Task <IActionResult> AssignDone([FromRoute] string projectId, [FromForm] DoneViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _mongoProjectService.AssignDone(projectId, model);

                if (result)
                {
                    return(Ok(new { status = 1, message = "Success to add done" }));
                }
                return(BadRequest(new { status = 1, message = "Something wrong happen" }));
            }
            return(BadRequest(new { status = 0, message = "Bad request" }));
        }
        public async Task <bool> AssignDone(string projectId, DoneViewModel model)
        {
            var project = await _NoDb.FindAsync(projectId, projectId);

            var done = new Done
            {
                Id          = Guid.NewGuid().ToString(),
                Descreption = model.Descreption,
                Name        = model.Name,
                StartDate   = model.StartDate,
                EndDate     = model.EndDate
            };

            project.Framework.Dones.Add(done);
            var result = await _NoDb.UpdateAsync(project);

            return(result.IsSuccess);
        }
        public async Task <bool> AssignDone(string projectId, DoneViewModel model)
        {
            var result = await _Projects.FindAsync(proj => proj.Id == projectId);

            var project = await result.SingleOrDefaultAsync();

            var done = new MongoDone
            {
                Id          = Guid.NewGuid().ToString(),
                Descreption = model.Descreption,
                Name        = model.Name,
                StartDate   = model.StartDate,
                EndDate     = model.EndDate
            };

            project.Framework.Dones.Add(done);
            var resultReplace = await _Projects.ReplaceOneAsync(proj => proj.Id == projectId, project);

            return(resultReplace.IsAcknowledged);
        }
        public IActionResult DoneTodos()
        {
            List <ToDo> DoneTodos = _todoService.GetAllToDos()
                                    .Where(t => t.Status == Status.Done)
                                    .ToList();
            List <ToDoViewModel> DoneView = new List <ToDoViewModel>();

            foreach (var toDo in DoneTodos)
            {
                List <SubTaskViewModel> subTaskView = new List <SubTaskViewModel>();
                foreach (var subtask in toDo.SubTasks)
                {
                    subTaskView.Add(new SubTaskViewModel()
                    {
                        Title      = subtask.Title,
                        Descrition = subtask.Descrition,
                        SubStatus  = subtask.SubStatus
                    });
                }
                DoneView.Add(new ToDoViewModel()
                {
                    Id              = toDo.Id,
                    Title           = toDo.Title,
                    Descrition      = toDo.Descrition,
                    ImporanceOfTask = toDo.ImporanceOfTask,
                    TypeOfTodo      = toDo.TypeOfToDo,
                    Status          = toDo.Status,
                    SubTasks        = subTaskView
                });
            }
            DoneViewModel model = new DoneViewModel()
            {
                DoneTasks = DoneView
            };

            return(View(model));
        }
        public ActionResult Create(DoneViewModel model)
        {
            try
            {
                // TODO: Add insert logic here
                if (SingletonData.Singleton.StoreReparationDoneInitialized == false)
                {
                    SingletonData.Singleton.StoreReparationDone            = new MockDataServiceReparationDone();
                    SingletonData.Singleton.StoreReparationDoneInitialized = true;
                }

                foreach (var item in SingletonData.Singleton.StoreReparationDone.ReturnList())
                {
                    item.basemodel.Totaal = item.basemodel.PrijsArbeid + item.basemodel.PrijsProducten;
                }

                SingletonData.Singleton.StoreReparationDone.AddItem(model);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #9
0
 protected override void OnInitialized()
 {
     Done = new DoneViewModel {
         StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(1)
     };
 }