private void btnSave_Click(object sender, EventArgs e) { try { txtID.Text = txtID.Text.ToUpper().Replace(" ", ""); txtName.Text = txtName.Text.Trim(); LAssemblyReport obj; if (ValidData()) { if (txtID.Enabled) { obj = new LAssemblyReport(); obj.AssemblyReportId = Utility.sDbnull(txtID.Text); obj.ReportName = Utility.sDbnull(txtName.Text); obj.SDLLname = Utility.sDbnull(txtDll.Text); obj.SAssemblyName = Utility.sDbnull(cboASM.SelectedValue); obj.Desc = Utility.sDbnull(txtDesc.Text); obj.IsNew = true; obj.Save(); obj = LAssemblyReport.FetchByID(Utility.sDbnull(txtID.Text)); if (obj != null) { DataRow newDr = dtList.NewRow(); Utility.FromObjectToDatarow(obj, ref newDr); dtList.Rows.Add(newDr); txtID.Enabled = false; } } else { new Update(LAssemblyReport.Schema.Name).Set(LAssemblyReport.Columns.ReportName).EqualTo(txtName.Text). Set(LAssemblyReport.Columns.Desc).EqualTo(txtDesc.Text). Set(LAssemblyReport.Columns.SAssemblyName).EqualTo(Utility.sDbnull(cboASM.SelectedValue)). Set(LAssemblyReport.Columns.SDLLname).EqualTo(txtDll.Text). Where(LAssemblyReport.Columns.AssemblyReportId).IsEqualTo(Utility.sDbnull(txtID.Text)). Execute(); obj = LAssemblyReport.FetchByID(Utility.sDbnull(txtID.Text)); if (obj != null) { DataRow newDr = Utility.GetDataRow(dtList, LAssemblyReport.Columns.AssemblyReportId, Utility.sDbnull(txtID.Text)); Utility.FromObjectToDatarow(obj, ref newDr); newDr.AcceptChanges(); } } } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void LoadData() { LAssemblyReport objManufacture = LAssemblyReport.FetchByID(txtID.Text); if (objManufacture != null) { txtName.Text = Utility.sDbnull(objManufacture.ReportName); txtDll.Text = Utility.sDbnull(objManufacture.SDLLname); LoadCrptListToComboBox(txtDll.Text); cboASM.SelectedValue = Utility.sDbnull(objManufacture.SAssemblyName); txtDesc.Text = Utility.sDbnull(objManufacture.Desc); txtID.Enabled = false; } }