//[AuthorizeAdmin(Permissions = new Permission[] { Permission.Floor_Create, Permission.Floor_Edit })] public ActionResult CreateEdit(WAREHOUSE model) { if (model.ID == 0) { var result = KhoService.Create(model); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("Index", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); } else { var result = KhoService.Edit(model); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("Index", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); } }
public ActionResult List(CTKhoSearchModel searchModel) { var pagedList = KhoService.SearchCTKho(searchModel.KhoID, searchModel.SanPhamID, searchModel.PageIndex); pagedList.SearchModel = searchModel; return(PartialView("_List", pagedList)); }
private async void btnXoa_Click(object sender, EventArgs e) { if (lvKho.SelectedItems.Count == 0) { MessageBoxEx.Show("Bạn phải chọn 1 nhà kho để xóa!", "Thông báo"); } else { int idKho = txtIdKho.Text == "" ? 0 : int.Parse(txtIdKho.Text); if (idKho == 0) { MessageBoxEx.Show("Không thể xóa nhà kho này!", "Thông báo"); } else { DialogResult res = MessageBoxEx.Show("Bạn có chắc chắn muốn xóa nhà kho này ?", "Thông báo", MessageBoxButtons.OKCancel); if (res == DialogResult.OK) { var result = await KhoService.XoaKho(idKho); if (result.Status == Config.CODE_OK) { MessageBoxEx.Show("Xóa nhà kho thành công", "Thông báo"); LoadKho(); ClearLayout(); } else { MessageBoxEx.Show("Xóa nhà kho thất bại", "Thông báo"); } } } } }
public ActionResult List(KhoSearchModel searchModel) { var pagedList = KhoService.Search(searchModel.WarehouseName, searchModel.Status, searchModel.PageIndex); pagedList.SearchModel = searchModel; return(PartialView("_List", pagedList)); }
private async void LoadDanhSachVatTu(int Id) { var result = await KhoService.LayTatCaVatTuTheoKhoDgv(Id); if (result != null && result.Status == Config.CODE_OK) { listVatTuTheoKho = (List <VatTuNhapXuat>)result.Data; foreach (var item in listVatTuTheoKho) { var vatTu = listChiTietXuatKho.SingleOrDefault(x => x.VatTu.Id == item.Id); if (vatTu == null) { item.SoLuong = 0; item.GhiChu = ""; } else { item.SoLuong = vatTu.SoLuong; item.GhiChu = vatTu.GhiChu; } } } dgvVatTu.DataSource = typeof(List <VatTuNhapXuat>); dgvVatTu.DataSource = listVatTuTheoKho; EditDataGridView(listVatTuTheoKho); }
public ActionResult Edit(int id) { ViewBag.Status = WebUtil.GetEnumSelectList <Warehouse_Status>(); var model = KhoService.GetById(id); //TODO return(View("CreateEdit", model)); }
private async void LoadKho() { var result = await KhoService.LayTatCaKho(); if (result != null && result.Status == Config.CODE_OK) { listKho = (List <Kho>)result.Data; cboKho.DataSource = listKho; cboKho.DisplayMember = "Ten"; cboKho.ValueMember = "Id"; } }
private async void btnLuu_Click(object sender, EventArgs e) { ResponseData result = null; if (currentKho != null) // Add new { currentKho.Ma = txtMaKho.Text; currentKho.Ten = txtTenKho.Text; currentKho.DiaChi = txtDiaChi.Text; currentKho.GhiChu = txtGhiChu.Text; currentKho.SDT = txtSDT.Text; currentKho.QuanLy = new NhanVien() { Id = (int)cboQuanLy.SelectedValue }; result = await KhoService.ThemMoiKho(currentKho); } else // Update { currentKho = new Kho(); currentKho.Ma = txtMaKho.Text; currentKho.Ten = txtTenKho.Text; currentKho.DiaChi = txtDiaChi.Text; currentKho.GhiChu = txtGhiChu.Text; currentKho.SDT = txtSDT.Text; currentKho.QuanLy = new NhanVien() { Id = (int)cboQuanLy.SelectedValue }; currentKho.Id = int.Parse(txtIdKho.Text); result = await KhoService.CapNhatKho(currentKho); } if (result.Status == Config.CODE_OK) { MessageBoxEx.Show(result.Message, "Thông báo"); ClearLayout(); LoadKho(); } else if (result != null) { MessageBoxEx.Show(result.Message, "Thông báo"); } else { MessageBoxEx.Show("Opps!!!", "Thông báo"); } currentKho = null; }
private async void LoadKho() { var result = await KhoService.LayTatCaKho(); if (result != null && result.Status == Config.CODE_OK) { listKho = (List <Kho>)result.Data; cboKho.DataSource = listKho; cboKho.DisplayMember = "Ten"; cboKho.ValueMember = "Id"; isLoadingKhoDone = true; isLoadingKhoDone = true; if (ucXuatKho.idPhieuXuat == 0) { LoadDanhSachVatTu(listKho[0].Id); dtpNgayNhap.Value = DateTime.Now; } } }
private async void LoadKho() { var result = await KhoService.LayTatCaKho(); if (result != null && result.Status == Config.CODE_OK) { listKho = (List <Kho>)result.Data; lvKho.Items.Clear(); foreach (Kho kho in listKho) { ListViewItem listViewItem = new ListViewItem(kho.Ma.ToString()); listViewItem.SubItems.Add(kho.Ten); listViewItem.SubItems.Add(kho.DiaChi); listViewItem.SubItems.Add(kho.SDT); listViewItem.SubItems.Add(kho.QuanLy.Ten); listViewItem.SubItems.Add(kho.GhiChu); listViewItem.SubItems[0].Tag = kho.Id; lvKho.Items.Add(listViewItem); } } }