/// <summary> /// Create /// </summary> /// <param name="model"></param> /// <returns></returns> public static TimeSheetGroupWorkShiftModel Create(TimeSheetGroupWorkShiftModel model) { // init entity var entity = new hr_TimeSheetGroupWorkShift(); // fill entity model.FillEntity(ref entity); // create return(new TimeSheetGroupWorkShiftModel(hr_TimeSheetGroupWorkShiftServices.Create(entity))); }
protected void InsertOrUpdate(object sender, DirectEventArgs e) { try { var time = new hr_TimeSheetGroupWorkShift() { Name = txtName.Text, CreatedDate = DateTime.Now, CreatedBy = CurrentUser.User.UserName, }; if (e.ExtraParams["Command"] == "Update") { if (!string.IsNullOrEmpty(hdfKeyRecord.Text)) { var editTime = hr_TimeSheetGroupWorkShiftServices.GetById(Convert.ToInt32(hdfKeyRecord.Text)); if (editTime != null) { editTime.Name = txtName.Text; editTime.EditedDate = DateTime.Now; } hr_TimeSheetGroupWorkShiftServices.Update(editTime); } } else { hr_TimeSheetGroupWorkShiftServices.Create(time); } if (e.ExtraParams["Close"] == "True") { wdGroupWorkShift.Hide(); } //reload data gridGroupWorkShift.Reload(); } catch (Exception ex) { ExtNet.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show(); } }