public bool Exist(CodeEntity codeEntity) { DataRow[] rows = this.Codes.Select("ID = '"+ codeEntity.ID +"' AND Code = '"+ codeEntity.Code +"'"); if (rows.Length > 0) return true; else return false; }
public void Delete(CodeEntity codeEntity) { DatabaseLib.DatabaseFactory dataFactory = new DatabaseLib.DatabaseFactory(); DatabaseLib.IDatabase dataClient = dataFactory.CreateClient(BaseLib.SystemType.Web); string strSql = "DELETE FROM s_codes WHERE ID = '@ID@'"; strSql = strSql.Replace("@ID@", codeEntity.ID); dataClient.SqlText = strSql; DataSet ds = dataClient.Query(); this.Message = dataClient.Message; this.Result = dataClient.Result; }
public void Add(CodeEntity codeEntity) { DatabaseLib.DatabaseFactory dataFactory = new DatabaseLib.DatabaseFactory(); DatabaseLib.IDatabase dataClient = dataFactory.CreateClient(BaseLib.SystemType.Web); string strSql = "INSERT INTO s_codes(ID, Text, Value, Code, CodeText) VALUES('@ID@', '@Text@', '@Value@', '@Code@', '@CodeText@')"; strSql = strSql.Replace("@ID@", codeEntity.ID); strSql = strSql.Replace("@Text@", codeEntity.Text); strSql = strSql.Replace("@Value@", codeEntity.Value); strSql = strSql.Replace("@Code@", codeEntity.Code); strSql = strSql.Replace("@CodeText@", codeEntity.CodeText); dataClient.SqlText = strSql; DataSet ds = dataClient.Query(); this.Message = dataClient.Message; this.Result = dataClient.Result; }
public void Modify(CodeEntity codeEntity) { DatabaseLib.DatabaseFactory dataFactory = new DatabaseLib.DatabaseFactory(); DatabaseLib.IDatabase dataClient = dataFactory.CreateClient(BaseLib.SystemType.Web); string strSql = "UPDATE s_codes SET Text = '@Text@', Value = '@Value@' WHERE ID = '@ID@'; UPDATE s_codes SET CodeText = '@CodeText@ WHERE Code = '@Code@'"; strSql = strSql.Replace("@ID@", codeEntity.ID); strSql = strSql.Replace("@Text@", codeEntity.Text); strSql = strSql.Replace("@Value@", codeEntity.Value); strSql = strSql.Replace("@Code@", codeEntity.Code); strSql = strSql.Replace("@CodeText@", codeEntity.CodeText); dataClient.SqlText = strSql; DataSet ds = dataClient.Query(); this.Message = dataClient.Message; this.Result = dataClient.Result; }