using System; using System.Data; using OakLeaf.MM.Main.Business; using OakLeaf.MM.Main.Data; namespace msi.pdx.dxServices { /// <summary> /// Summary description for Dx. /// </summary> public class Dx : ABusinessObject { public Dx() { // // TODO: Add constructor logic here // this.UpdateSelectStatement = "Select * from DX"; this.TableName = "DX"; this.PrimaryKey = "ICDACode"; this.RetrieveAutoIncrementPK = false; } public DataSet GetAllDx() { return this.GetDataSet("SELECT * From DX"); } public DataSet GetAllDx(string xdx) { return this.GetDataSet("SELECT * From DX where ICDACODE like '" + xdx + "%'"); } protected override void HookSetDefaultValues(DataRow dataRow) { if (this.DefaultValues != null) { DxDefaultValues Defaults = (DxDefaultValues)this.DefaultValues; dataRow["Valid"] = Defaults.Valid; } } protected override mmBusinessRule CreateBusinessRuleObject() { return new DxRules(this); } } }
using System; namespace msi.pdx.dxServices { /// <summary> /// Summary description for DxDefaultValues. /// </summary> public struct DxDefaultValues { public string Valid; public DxDefaultValues(string Valid) { // // TODO: Add constructor logic here // this.Valid = "Y"; } } }
using System; using System.Data; using OakLeaf.MM.Main.Business; namespace msi.pdx.dxServices { /// <summary> /// Summary description for DxRules. /// </summary> public class DxRules : ABusinessRule { public DxRules(ImmBusinessRuleHost hostObject): base(hostObject) { // // TODO: Add constructor logic here // } public override bool CheckRulesHook(DataSet ds, string tableName) { if (ds != null) { DataRow dr = ds.Tables[tableName].Rows[0]; this.CheckForDuplicateICDACode(dr["ICDACode"].ToString()); } return this.ErrorProviderBrokenRuleCount == 0; } public string CheckForDuplicateICDACode(string icdacode) { //string message = null; string message = "Duplicate Key!"; this.AddBrokenRule(message); return message; } } }