public bool XoaNhanVien(string MaNV, ref string error) { try { QuanLyCaPheEntities qlcp = new QuanLyCaPheEntities(); ChamCong chamcong = new ChamCong(); chamcong.MaNV = int.Parse(MaNV); qlcp.ChamCongs.Attach(chamcong); qlcp.ChamCongs.Remove(chamcong); qlcp.SaveChanges(); return(true); } catch (Exception err) { error = err.Message; return(false); } }
public bool ThemNhanVien(string MaNV, string TenNV, ref string error) { try { QuanLyCaPheEntities qlcp = new QuanLyCaPheEntities(); ChamCong chamcong = new ChamCong(); chamcong.MaNV = int.Parse(MaNV); chamcong.TenNV = TenNV; chamcong.GioIn = TimeSpan.Zero; chamcong.GioOut = TimeSpan.Zero; qlcp.ChamCongs.Add(chamcong); qlcp.SaveChanges(); return(true); } catch (Exception err) { error = err.Message; return(false); } }