protected void grvNhomChucDanh_UpdateCommand(object sender, GridCommandEventArgs e) { GridEditableItem item = e.Item as GridEditableItem; switch (e.Item.OwnerTableView.Name) { case "tbl_NhomChucDanh": var iDNhomChucDanh = Convert.ToInt32(item.GetDataKeyValue("IDNhomChucDanh").ToString()); NhomChucDanh nhomchucdanh = _entities.NhomChucDanhs.Where(d => d.IDNhomChucDanh == iDNhomChucDanh).First(); nhomchucdanh.NgayCapNhat = DateTime.Now; nhomchucdanh.NguoiCapNhat = idNhanVien; item.UpdateValues(nhomchucdanh); _entities.SaveChanges(); break; case "tbl_ChucDanhChuyenMon": var iDChucDanhChuyenMon = Convert.ToInt32(item.GetDataKeyValue("IDChucDanh").ToString()); ChucDanh chucdanh = _entities.ChucDanhs.Where(d => d.IDChucDanh == iDChucDanhChuyenMon).First(); chucdanh.NgayCapNhat = DateTime.Now; chucdanh.NguoiCapNhat = idNhanVien; item.UpdateValues(chucdanh); _entities.SaveChanges(); break; } }
public async Task <IActionResult> PutChucDanh([FromRoute] int id, [FromBody] ChucDanh chucdanh) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != chucdanh.ChucDanhId) { return(BadRequest()); } _context.Entry(chucdanh).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChucDanhExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
protected void grvNhomChucDanh_InsertCommand(object sender, GridCommandEventArgs e) { GridEditableItem item = e.Item as GridEditableItem; Hashtable values = new Hashtable(); item.ExtractValues(values); switch (e.Item.OwnerTableView.Name) { case "tbl_NhomChucDanh": NhomChucDanh nhomchucdanh = new NhomChucDanh(); nhomchucdanh.NgayTao = nhomchucdanh.NgayCapNhat = DateTime.Now; nhomchucdanh.NguoiTao = nhomchucdanh.NguoiCapNhat = idNhanVien; item.UpdateValues(nhomchucdanh); _entities.AddToNhomChucDanhs(nhomchucdanh); _entities.SaveChanges(); break; case "tbl_ChucDanhChuyenMon": ChucDanh chucdanh = new ChucDanh(); item.UpdateValues(chucdanh); GridDataItem parentItem = e.Item.OwnerTableView.ParentItem; if (parentItem != null) { var idNhomChucDanh = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["IDNhomChucDanh"].ToString(); chucdanh.IDNhomChucDanh = Convert.ToInt32(idNhomChucDanh); chucdanh.NgayTao = chucdanh.NgayCapNhat = DateTime.Now; chucdanh.NguoiTao = chucdanh.NguoiCapNhat = idNhanVien; _entities.AddToChucDanhs(chucdanh); _entities.SaveChanges(); } break; } }
public bool XoaChucDanh(string Id) { ChucDanh chucDanh = new ChucDanh(); chucDanh.ID = int.Parse(Id); return(ChucDanhDAO.Instance.XoaChucDanh(chucDanh)); }
public ThongTinBoNhiem() { InitializeComponent(); oDonVi = new DonVi(); oChucVu = new ChucVu(); oChucDanh = new ChucDanh(); oLoaiPhuCap = new Business.HDQD.LoaiPhuCap(); }
public bool ThemChucDanh(ChucDanh chucDanh) { SimpleQuanLyKhachSanEntities QLKSEntities = new SimpleQuanLyKhachSanEntities(); QLKSEntities.ChucDanhs.Add(chucDanh); QLKSEntities.SaveChanges(); return(true); }
public ChucDanh GetForm() { ChucDanh d = new ChucDanh(); d.MaChucDanh = (txtMachucdanh.Text != "") ?int.Parse(txtMachucdanh.Text):-1; d.TenChucDanh = txtTenchucdanh.Text; d.MoTaCongViec = txtMota.Text; return(d); }
public void RefreshDataTables() { DtbDonVi = DonVi.GetDtbDonVi(); DtbCaNhan = CaNhan.GetDtbCaNhan(); DtbChucDanh = ChucDanh.GetDtbChucDanh(); DtbChucVu = ChucVu.GetDtbChucVu(); DtbGioiTinh = GioiTinh.GetDtbGioiTinh(); DtbLoaiDonVi = LoaiDonVi.GetDtbLoaiDonVi("id > 0"); }
public bool XoaChucDanh(ChucDanh chucDanh) { SimpleQuanLyKhachSanEntities QLKSEntities = new SimpleQuanLyKhachSanEntities(); QLKSEntities.ChucDanhs.Attach(chucDanh); QLKSEntities.ChucDanhs.Remove(chucDanh); QLKSEntities.SaveChanges(); return(true); }
private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (gridView1.SelectedRowsCount > 0) { ChucDanh d = (ChucDanh)gridView1.GetRow(gridView1.GetSelectedRows()[0]); txtMota.Text = d.MoTaCongViec; txtTenchucdanh.Text = d.TenChucDanh; txtMachucdanh.Text = d.MaChucDanh.ToString(); } }
public DieuDong() { InitializeComponent(); oDonVi = new DonVi(); oChucVu = new ChucVu(); oChucDanh = new ChucDanh(); //oKiemNhiem = new Business.HDQD.KiemNhiem(); oFTP = new Business.FTP(); InitObjects(); }
public async Task <IActionResult> PostChucDanh([FromBody] ChucDanh chucdanh) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ChucDanhs.Add(chucdanh); await _context.SaveChangesAsync(); return(CreatedAtAction("GetChucDanh", new { id = chucdanh.ChucDanhId }, chucdanh)); }
public bool SuaChucDanh(ChucDanh chucDanh) { SimpleQuanLyKhachSanEntities QLKSEntities = new SimpleQuanLyKhachSanEntities(); var Query = (from p in QLKSEntities.ChucDanhs where p.ID == chucDanh.ID select p).SingleOrDefault(); if (Query != null) { Query.Ten = chucDanh.Ten; QLKSEntities.SaveChanges(); } return(true); }
public bool ThemChucDanh(string TenChucDanh) { ChucDanh chucDanh = new ChucDanh(); try { chucDanh.Ten = TenChucDanh; } catch (Exception) { return(false); } return(ChucDanhDAO.Instance.ThemChucDanh(chucDanh)); }
public bool SuaChucDanh(string Id, string TenChucDanh) { ChucDanh chucDanh = new ChucDanh(); try { chucDanh.ID = int.Parse(Id); chucDanh.Ten = TenChucDanh; } catch (Exception) { return(false); } return(ChucDanhDAO.Instance.SuaChucDanh(chucDanh)); }
protected void grvNhomChucDanh_DeleteCommand(object sender, GridCommandEventArgs e) { switch (e.Item.OwnerTableView.Name) { case "tbl_NhomChucDanh": var iDNhomChucDanh = (e.Item as GridDataItem).GetDataKeyValue("IDNhomChucDanh").ToString(); int id = Convert.ToInt32(iDNhomChucDanh); _entities.DeleteChucDanhChuyenMonByIDNhomChucDanh(id); _entities.SaveChanges(); break; case "tbl_ChucDanhChuyenMon": var iDChucDanhChuyenMon = (e.Item as GridDataItem).GetDataKeyValue("IDChucDanh").ToString(); int idcm = Convert.ToInt32(iDChucDanhChuyenMon); ChucDanh chucdanh = _entities.ChucDanhs.Where(d => d.IDChucDanh == idcm).First(); _entities.ChucDanhs.DeleteObject(chucdanh); _entities.SaveChanges(); break; } }