private void OnSaveInfo() { try { _xetNghiem.UpdatedDate = DateTime.Now; _xetNghiem.UpdatedBy = Guid.Parse(Global.UserGUID); MethodInvoker method = delegate { _xetNghiem.TenXetNghiem = txtTenXetNghiem.Text; _xetNghiem.FullName = txtTenXetNghiem.Text; if (chkFromValue_Normal.Checked) { _xetNghiem.FromValue = (double)numFromValue_Normal.Value; } if (chkToValue_Normal.Checked) { _xetNghiem.ToValue = (double)numToValue_Normal.Value; } if (chkFromValue_NormalPercent.Enabled && chkFromValue_NormalPercent.Checked) { _xetNghiem.FromPercent = (double)numFromValue_NormalPercent.Value; } if (chkToValue_NormalPercent.Enabled && chkToValue_NormalPercent.Checked) { _xetNghiem.ToPercent = (double)numToValue_NormalPercent.Value; } Result result = XetNghiem_CellDyn3200Bus.UpdateXetNghiem(_xetNghiem); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("XetNghiem_CellDyn3200Bus.UpdateXetNghiem"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_CellDyn3200Bus.UpdateXetNghiem")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } catch (Exception e) { MsgBox.Show(this.Text, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }
private void OnSaveInfo() { try { XetNghiem_CellDyn3200 xetNghiem = new XetNghiem_CellDyn3200(); xetNghiem.XetNghiemGUID = Guid.Parse(_row["XetNghiemGUID"].ToString()); xetNghiem.UpdatedDate = DateTime.Now; xetNghiem.UpdatedBy = Guid.Parse(Global.UserGUID); MethodInvoker method = delegate { xetNghiem.TenXetNghiem = _tenXetNghiem; xetNghiem.FullName = _tenXetNghiem; if (chkFromValue_Normal.Checked) { xetNghiem.FromValue = (double)numFromValue_Normal.Value; } if (chkToValue_Normal.Checked) { xetNghiem.ToValue = (double)numToValue_Normal.Value; } //if (chkFromValue_NormalPercent.Enabled && chkFromValue_NormalPercent.Checked) // xetNghiem.FromPercent = (double)numFromValue_NormalPercent.Value; //if (chkToValue_NormalPercent.Enabled && chkToValue_NormalPercent.Checked) // xetNghiem.ToPercent = (double)numToValue_NormalPercent.Value; Result result = XetNghiem_CellDyn3200Bus.UpdateXetNghiem(xetNghiem); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("XetNghiem_CellDyn3200Bus.UpdateXetNghiem"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("XetNghiem_CellDyn3200Bus.UpdateXetNghiem")); } else { DataRow row = GetDataRow(xetNghiem.XetNghiemGUID.ToString()); if (row != null) { if (chkFromValue_Normal.Checked) { row["FromValue"] = xetNghiem.FromValue.Value; } else { row["FromValue"] = DBNull.Value; } if (chkToValue_Normal.Checked) { row["ToValue"] = xetNghiem.ToValue.Value; } else { row["ToValue"] = DBNull.Value; } //if (chkFromValue_NormalPercent.Enabled && chkFromValue_NormalPercent.Checked) // row["FromPercent"] = xetNghiem.FromPercent.Value; //else // row["FromPercent"] = DBNull.Value; //if (chkToValue_NormalPercent.Enabled && chkToValue_NormalPercent.Checked) // row["ToPercent"] = xetNghiem.ToPercent.Value; //else // row["ToPercent"] = DBNull.Value; MsgBox.Show(Application.ProductName, "Lưu chỉ số xét nghiệm thành công.", IconType.Information); } } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } catch (Exception e) { MsgBox.Show(Application.ProductName, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }