void Click_Event(object sender, DirectEventArgs e) { try { ThamSoTrangThaiController controller = new ThamSoTrangThaiController(); DAL.ThamSoTrangThai item = controller.GetByID(int.Parse("0" + grpWorkingStatus.GetSelectedRecordIDs().FirstOrDefault())); if (item != null) { txtDescription.Text = item.Description; txtWorkingStatusName.Text = item.Value; } //DAL.ThamSoTrangThai item = new DAL.ThamSoTrangThai() //{ // CreatedBy = CurrentUser.ID, // CreatedDate = DateTime.Now, // Description = txtDescription.Text, // IsInUsed = true, // MaDonVi = Session["MaDonVi"].ToString(), // Value = txtWorkingStatusName.Text, // ParamName = ThamSoTrangThaiController.HINH_THUC_LAM_VIEC //}; //foreach (var i in grpWorkingStatus.GetSelectedRecordIDs()) //{ // item.ID = int.Parse(i); //} //controller.Update(item); wdWorkingStatus.Show(); } catch (Exception ex) { X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show(); } }
public void Update(DAL.ThamSoTrangThai thamso) { DAL.ThamSoTrangThai tmp = GetByID(thamso.ID); tmp.IsInUsed = thamso.IsInUsed; tmp.ParamName = thamso.ParamName; tmp.Value = thamso.Value; tmp.Order = thamso.Order; tmp.Description = thamso.Description; Save(); }
protected void btnUpdate_Click(object sender, DirectEventArgs e) { try { ThamSoTrangThaiController controller = new ThamSoTrangThaiController(); DAL.ThamSoTrangThai item = new DAL.ThamSoTrangThai() { CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, Description = txtDescription.Text, IsInUsed = true, MaDonVi = Session["MaDonVi"].ToString(), Value = txtWorkingStatusName.Text, ParamName = ThamSoTrangThaiController.HINH_THUC_LAM_VIEC }; if (e.ExtraParams["Command"] == "Update") { item.ID = int.Parse("0" + grpWorkingStatus.GetSelectedRecordIDs().FirstOrDefault()); controller.Update(item); } else { controller.Add(item); } if (e.ExtraParams["Close"] == "True") { wdWorkingStatus.Hide(); } else { txtWorkingStatusName.Text = ""; txtDescription.Text = ""; } grpWorkingStatus.GetGridPanel().Reload(); } catch (Exception ex) { X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show(); } }
public void Add(DAL.ThamSoTrangThai thamSoTrangThai) { dataContext.ThamSoTrangThais.InsertOnSubmit(thamSoTrangThai); Save(); }