private void LoadData() { cboTestType.Enabled = TTestgroupDtl.CreateQuery().WHERE(TTestgroupDtl.Columns.TestGroupId, Utility.Int32Dbnull(txtID.Text)). GetRecordCount() <= 0; TTestgroupList obj = TTestgroupList.FetchByID(Utility.Int32Dbnull(txtID.Text)); if (obj != null) { txtName.Text = Utility.sDbnull(obj.TestGroupName, ""); cboTestType.SelectedValue = Utility.Int32Dbnull(obj.TestTypeId, -1); } }
private void btnSave_Click(object sender, EventArgs e) { try { txtID.Text = txtID.Text.ToUpper(); TTestgroupList obj = new TTestgroupList(); if (ValidData()) { switch (txtID.Text) { case "-1": //var obj = new LManufacture(); obj.TestGroupName = Utility.sDbnull(txtName.Text); obj.TestTypeId = Utility.Int32Dbnull(cboTestType.SelectedValue); obj.IsNew = true; obj.Save(); txtID.Text = Utility.sDbnull(TTestgroupList.CreateQuery().GetMax(TTestgroupList.Columns.TestGroupId)); obj = TTestgroupList.FetchByID(Utility.Int32Dbnull(txtID.Text, -1)); if (obj != null) { DataRow newDr = dtList.NewRow(); Utility.FromObjectToDatarow(obj, ref newDr); newDr["TestType_Name"] = cboTestType.Text; dtList.Rows.Add(newDr); } break; default: new Update(TTestgroupList.Schema.Name).Set(TTestgroupList.Columns.TestGroupName).EqualTo(txtName.Text). Set(TTestgroupList.Columns.TestTypeId).EqualTo(Utility.Int32Dbnull(cboTestType.SelectedValue, -1)). Where(TTestgroupList.Columns.TestGroupId).IsEqualTo(Utility.Int32Dbnull(txtID.Text)). Execute(); obj = TTestgroupList.FetchByID(Utility.Int32Dbnull(txtID.Text, -1)); if (obj != null) { DataRow newDr = Utility.GetDataRow(dtList, TTestgroupList.Columns.TestGroupId, obj.TestGroupId); Utility.FromObjectToDatarow(obj, ref newDr); newDr["TestType_Name"] = cboTestType.Text; newDr.AcceptChanges(); } break; } } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
public void Insert(string TestGroupName,string Description,decimal? DeviceId,int? TestTypeId,short? TestGroupOrder) { TTestgroupList item = new TTestgroupList(); item.TestGroupName = TestGroupName; item.Description = Description; item.DeviceId = DeviceId; item.TestTypeId = TestTypeId; item.TestGroupOrder = TestGroupOrder; item.Save(UserName); }
public void Update(int TestGroupId,string TestGroupName,string Description,decimal? DeviceId,int? TestTypeId,short? TestGroupOrder) { TTestgroupList item = new TTestgroupList(); item.MarkOld(); item.IsLoaded = true; item.TestGroupId = TestGroupId; item.TestGroupName = TestGroupName; item.Description = Description; item.DeviceId = DeviceId; item.TestTypeId = TestTypeId; item.TestGroupOrder = TestGroupOrder; item.Save(UserName); }