protected string ChamCong(DateTime _ngaythang, int _lamviecID) { string result = "X"; Models.ChamCong chamcong = _ccEntity.FindByNgayThangLamViec(_lamviecID, _ngaythang); if (chamcong != null) { result = chamcong.LoaiChamCong.LCCKyHieu; } return(result); }
public void Insert(int _lamviecID, DateTime _ngaythang, int _loaichamcongID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.ChamCong chamcong = db.ChamCongs.FirstOrDefault(x => x.LVID == _lamviecID && x.CCDATE == _ngaythang); if (chamcong != null) { db.ChamCongs.Remove(chamcong); } chamcong = new ChamCong(); chamcong.LVID = _lamviecID; chamcong.CCDATE = _ngaythang; chamcong.LCCID = _loaichamcongID; db.ChamCongs.Add(chamcong); db.SaveChanges(); db.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { lblNgayThang.Text = _ngaychamcong.ToString("dd/MM/yyyy"); lblDonVi.Text = _lamviec.DonVi.DVTen; lblNhanVien.Text = _lamviec.NhanVien.NVTen; if (!this.Page.IsPostBack) { Models.LoaiChamCongEntity lccEntity = new Models.LoaiChamCongEntity(); lccEntity.Load_AllLoaiChamCong_RadioButtonList(rblLoaiChamCong); Models.ChamCong chamcong = _ccEntity.FindByNgayThangLamViec(_lamviec.LVID, _ngaychamcong); if (chamcong != null) { rblLoaiChamCong.SelectedValue = chamcong.LCCID.ToString(); } else { rblLoaiChamCong.SelectedIndex = 0; } } }