/// <summary> /// 更新一条数据 /// </summary> public bool Update(Matisoft.Model.Sex_dir model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Sex_dir set "); strSql.Append("CustomerSex_exp=@CustomerSex_exp"); strSql.Append(" where CustomerSex=@CustomerSex "); SqlParameter[] parameters = { new SqlParameter("@CustomerSex_exp", SqlDbType.NChar, 10), new SqlParameter("@CustomerSex", SqlDbType.Int, 4) }; parameters[0].Value = model.CustomerSex_exp; parameters[1].Value = model.CustomerSex; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Matisoft.Model.Sex_dir model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Sex_dir("); strSql.Append("CustomerSex,CustomerSex_exp)"); strSql.Append(" values ("); strSql.Append("@CustomerSex,@CustomerSex_exp)"); SqlParameter[] parameters = { new SqlParameter("@CustomerSex", SqlDbType.Int, 4), new SqlParameter("@CustomerSex_exp", SqlDbType.NChar, 10) }; parameters[0].Value = model.CustomerSex; parameters[1].Value = model.CustomerSex_exp; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Sex_dir DataRowToModel(DataRow row) { Matisoft.Model.Sex_dir model = new Matisoft.Model.Sex_dir(); if (row != null) { if (row["CustomerSex"] != null && row["CustomerSex"].ToString() != "") { model.CustomerSex = int.Parse(row["CustomerSex"].ToString()); } if (row["CustomerSex_exp"] != null) { model.CustomerSex_exp = row["CustomerSex_exp"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Sex_dir DataRowToModel(DataRow row) { Matisoft.Model.Sex_dir model=new Matisoft.Model.Sex_dir(); if (row != null) { if(row["CustomerSex"]!=null && row["CustomerSex"].ToString()!="") { model.CustomerSex=int.Parse(row["CustomerSex"].ToString()); } if(row["CustomerSex_exp"]!=null) { model.CustomerSex_exp=row["CustomerSex_exp"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Sex_dir GetModel(int CustomerSex) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CustomerSex,CustomerSex_exp from Sex_dir "); strSql.Append(" where CustomerSex=@CustomerSex "); SqlParameter[] parameters = { new SqlParameter("@CustomerSex", SqlDbType.Int, 4) }; parameters[0].Value = CustomerSex; Matisoft.Model.Sex_dir model = new Matisoft.Model.Sex_dir(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Matisoft.Model.Sex_dir GetModel(int CustomerSex) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 CustomerSex,CustomerSex_exp from Sex_dir "); strSql.Append(" where CustomerSex=@CustomerSex "); SqlParameter[] parameters = { new SqlParameter("@CustomerSex", SqlDbType.Int,4) }; parameters[0].Value = CustomerSex; Matisoft.Model.Sex_dir model=new Matisoft.Model.Sex_dir(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }