Exemple #1
0
        public ActionResult Edit(int id)
        {
            var branch = _branchService.Get(id);

            branch.Dealers = _dealerService.OnlyWithBranchId(id);
            return(View(ActionType.Edit.ToString(), branch));
        }
        private LibraryAsset createNewLibraryAsset(AssetModel asset)
        {
            var discriminator = Enum.GetName(typeof(Discriminator), asset.Discriminator);
            var newAsset      = new LibraryAsset
            {
                Title          = asset.Title,
                Discriminator  = discriminator,
                DeweyIndex     = asset.DeweyCallNumber,
                NumberOfCopies = asset.NumberOfCopies,
                Year           = asset.Year,
                ISBN           = asset.ISBN,
                Cost           = asset.Cost,
                ImageUrl       = asset.ImageUrl,
                Location       = _branchService.Get(asset.CurrentLocation),
                Status         = _libraryAssetService.GetStatusById(2)
            };

            if (discriminator == "Book")
            {
                newAsset.Author = asset.AuthorOrDirector;
            }
            else
            {
                newAsset.Director = asset.AuthorOrDirector;
            }

            return(newAsset);
        }
Exemple #3
0
        public async Task <IActionResult> Get([FromQuery] GenericParams parameters)
        {
            var result = await _branchService.Get(parameters);

            var branches = _mapper.Map <IEnumerable <BranchDTO> >(result);

            return(Ok(branches));
        }
Exemple #4
0
        public IActionResult Get(int id)
        {
            var branch = _branchService.Get(id);

            if (branch == null)
            {
                return(NotFound());
            }
            return(Ok(branch));
        }
Exemple #5
0
        public BranchModule(IBranchService branchService)
        {
            Get["/branches", runAsync: true] = async (parameter, ct) =>
            {
                dynamic source = Request.Query.source;

                var branches = await Task.Run(() => branchService.Get(source));

                return Response.AsJson((IEnumerable<string>)branches);
            };
        }
Exemple #6
0
        public BranchModule(IBranchService branchService)
        {
            Get["/branches", runAsync : true] = async(parameter, ct) =>
            {
                dynamic source = Request.Query.source;

                var branches = await Task.Run(() => branchService.Get(source));

                return(Response.AsJson((IEnumerable <string>)branches));
            };
        }
Exemple #7
0
 private void bttn_teslimalan_teslimet_Click_1(object sender, EventArgs e)
 {
     if (cb_book_selectbook.SelectedIndex == -1)
     {
         _ = new uc_alertbox("İşlem yapılacak kitap seçilmemiş.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_book_selectbarcod.Text == "<kitap seçilmemiş>" || cb_book_selectbarcod.Text == "<barkod seçin>")
     {
         _ = new uc_alertbox("Aynı ada sahip başka bir kitap mevcut. Barkot numarasını listeden seçin.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_user_selectuser.Text == "<branş seçilmemiş>" || cb_user_selectuser.Text == "<kayıt yok>")
     {
         _ = new uc_alertbox("Kitabın kime teslim edileceği seçilmemiş.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_user_selectbranch.SelectedIndex == -1)
     {
         _ = new uc_alertbox("Teslim alan kişinin branşı seçilmemiş.", uc_alertbox.AlertType.Error, this); return;
     }
     AssignmentService.Add(new Assignment()
     {
         UserId     = UserService.Get(p => p.BranchId == BranchService.Get(f => f.Name == cb_user_selectbranch.SelectedItem.ToString()).Id&& p.Name == cb_user_selectuser.SelectedItem.ToString()).Id,
         Barcod     = Convert.ToInt64(cb_book_selectbarcod.SelectedItem),
         Notes      = tb_teslimalan_ekstranot.Text,
         AssignDate = (int)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds,
         DealedDate = (int)(dtp_teslimalan.Value.Subtract(new DateTime(1970, 1, 1))).TotalSeconds,
         Statu      = 1
     });
     BookService.Modify(new Book()
     {
         Id     = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Id,
         RCount = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).RCount + 1,
         Name   = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Name,
         Author = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Author,
         Barcod = BookService.Get(p => p.Barcod == Convert.ToInt64(cb_book_selectbarcod.SelectedItem)).Barcod,
         Statu  = 1,
     });
     _ = new uc_alertbox("Kitap teslim kaydı açıldı!", uc_alertbox.AlertType.Success, this);
     LoadBooks();
 }
Exemple #8
0
 private void Bttn_brans_degistir_Click(object sender, EventArgs e)
 {
     if (cb_branch_select.SelectedText == "branş / kullanıcı türü seç")
     {
         _ = new uc_alertbox("Branş adı değiştirmek için bir branş seçmelisin!", uc_alertbox.AlertType.Error, this); return;
     }
     if (tb_branch_name.Text == "" || tb_branch_name.Text.Length < 3)
     {
         _ = new uc_alertbox("Branşın ismi boş olamaz ve üç karakterden kısa olamaz.", uc_alertbox.AlertType.Error, this); return;
     }
     if (cb_branch_select.FindStringExact(tb_branch_name.Text) == 0)
     {
         _ = new uc_alertbox("Aynı ada sahip bir branş bulundu.", uc_alertbox.AlertType.Warning, this); return;
     }
     BranchService.Modify(new Branch()
     {
         Id = BranchService.Get(p => p.Name == cb_branch_select.SelectedItem.ToString()).Id, Name = tb_branch_name.Text
     });
     _ = new uc_alertbox(string.Format("{0} adlı branşın adı {1} olarak değiştirildi!", cb_branch_select.SelectedItem.ToString(), tb_branch_name.Text), uc_alertbox.AlertType.Success, this);
     LoadItems();
 }
        public IActionResult Detail(int branchId)
        {
            var branch = _branchService.Get(branchId);

            var model = new BranchDetailModel
            {
                Id              = branch.BranchId,
                Name            = branch.Name,
                Address         = branch.Address,
                Telephone       = branch.Telephone,
                OpenDate        = branch.OpenDate.Value.ToString("dd-MM-yyyy"),
                NumberOfAssets  = _branchService.GetAssets(branch.BranchId).Count(),
                NumberOfPatrons = _branchService.GetPatrons(branch.BranchId).Count(),
                TotalAssetValue = Math.Round(_branchService.GetAssets(branchId).Sum(a => a.Cost), 2),
                ImageUrl        = branch.ImageUrl,
                HoursOpen       = _branchService.GetBranchHours(branchId)
            };

            return(View(model));
        }
 public Branch Get(int id, bool @readonly = false)
 {
     return(_service.Get(id, @readonly));
 }
Exemple #11
0
 public Branch Get(GetBranchRequest request)
 {
     return(_branchService.Get(request));
 }
Exemple #12
0
        public async Task <IActionResult> Get()
        {
            var result = await _branchService.Get();

            return(Ok(result));
        }
 public IActionResult Get(int id)
 {
     return(Ok(_service.Get(id)));
 }