public override bool CreateCustomSmallType(CustomSmallType customSmallType) { StringBuilder strSql = new StringBuilder(); strSql.Append("Insert Into CustomSmallType("); strSql.Append("CustomSmallTypeId,CustomBigTypeId,CustomSmallTypeName"); strSql.Append(") Values ("); strSql.Append("@CustomSmallTypeId,@CustomBigTypeId,@CustomSmallTypeName"); strSql.Append(")"); SqlParameter[] parameters = { new SqlParameter("@CustomSmallTypeId", SqlDbType.UniqueIdentifier), new SqlParameter("@CustomBigTypeId", SqlDbType.UniqueIdentifier), new SqlParameter("@CustomSmallTypeName", SqlDbType.NVarChar) }; parameters[0].Value = customSmallType.CustomSmallTypeId; parameters[1].Value = customSmallType.CustomBigTypeId; parameters[2].Value = customSmallType.CustomSmallTypeName; int rows; try { rows = DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); } catch (SqlException ex) { throw ex; } return (rows > 0); }
public abstract bool UpdateCustomSmallType(CustomSmallType customSmallType);
public override bool UpdateCustomSmallType(CustomSmallType customSmallType) { StringBuilder strSql = new StringBuilder(); strSql.Append("Update CustomSmallType Set "); strSql.Append(@"CustomBigTypeId = @CustomBigTypeId, CustomSmallTypeName = @CustomSmallTypeName"); strSql.Append(" Where CustomSmallTypeId = @CustomSmallTypeId"); SqlParameter[] paramArray = { new SqlParameter("@CustomSmallTypeId", SqlDbType.UniqueIdentifier), new SqlParameter("@CustomBigTypeId", SqlDbType.UniqueIdentifier), new SqlParameter("@CustomSmallTypeName", SqlDbType.NVarChar) }; paramArray[0].Value = customSmallType.CustomSmallTypeId; paramArray[1].Value = customSmallType.CustomBigTypeId; paramArray[2].Value = customSmallType.CustomSmallTypeName; List<SqlParameter> parameters = new List<SqlParameter>(); parameters.AddRange(paramArray); int rows; try { rows = DbHelperSQL.ExecuteSql(strSql.ToString(),parameters.ToArray()); } catch (SqlException ex) { throw ex; } return (rows > 0); }
public CustomSmallType PopulateCustomSmallTypeFromIDataReader(IDataReader dr) { CustomSmallType model = null; if (dr != null) { model = new CustomSmallType(); if (dr["CustomSmallTypeId"] is System.DBNull) model.CustomSmallTypeId = null; else model.CustomSmallTypeId = (Guid)dr["CustomSmallTypeId"]; if (dr["CustomBigTypeId"] is System.DBNull) model.CustomBigTypeId = null; else model.CustomBigTypeId = (Guid)dr["CustomBigTypeId"]; model.CustomSmallTypeName = dr["CustomSmallTypeName"].ToString(); } return model; }