public string Insert(BILL_MobilePayFeeInfo bill_MobilePayFeeInfo) { DbCommand cmd = _dataBaseAccess.CreateCommand(); cmd.CommandText = "Proc_BILL_MobilePayFeeInfo_Insert"; ParameterAdd(ref cmd, bill_MobilePayFeeInfo); _dataBaseAccess.ExecuteCommand(cmd); return cmd.Parameters["@Result"].Value.ToString(); }
public string Update(BILL_MobilePayFeeInfo bill_MobilePayFeeInfo) { DbCommand cmd = _dataBaseAccess.CreateCommand(); cmd.CommandText = "Proc_BILL_MobilePayFeeInfo_Update"; ParameterAdd(ref cmd, bill_MobilePayFeeInfo); DbParameter param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@Id"; param.DbType = DbType.String; param.Value = bill_MobilePayFeeInfo.Id; cmd.Parameters.Add(param); _dataBaseAccess.ExecuteCommand(cmd); return cmd.Parameters["@Result"].Value.ToString(); }
private void ParameterAdd(ref DbCommand cmd, BILL_MobilePayFeeInfo bill_MobilePayFeeInfo) { if (bill_MobilePayFeeInfo.SubjectId.Length < 1 || bill_MobilePayFeeInfo.SubjectId.Length > 20) { throw new Exception("账单科目标识长度需在1-20个字符之间!"); } if (bill_MobilePayFeeInfo.SubjectName.Length < 1 || bill_MobilePayFeeInfo.SubjectName.Length > 50) { throw new Exception("账单科目名称长度需在1-50个字符之间!"); } DbParameter param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@SubjectId"; param.DbType = DbType.Int64; param.Value = bill_MobilePayFeeInfo.SubjectId; cmd.Parameters.Add(param); param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@SubjectName"; param.DbType = DbType.String; param.Value = bill_MobilePayFeeInfo.SubjectName; cmd.Parameters.Add(param); param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@Result"; param.DbType = DbType.String; param.Size = 50; param.Direction = ParameterDirection.Output; cmd.Parameters.Add(param); }