public Model.TT_CollierySupervise DataRowToModel(DataRow row) { TDTK.PlatForm.MVC4.Model.TT_CollierySupervise model = new TDTK.PlatForm.MVC4.Model.TT_CollierySupervise(); if (row != null) { if (row["CSCode"] != null) { model.CSCode = row["CSCode"].ToString(); } if (row["CollCode"] != null) { model.CollCode = row["CollCode"].ToString(); } if (row["MCode"] != null) { model.MCode = row["MCode"].ToString(); } if (row["MPName"] != null) { model.MPName = row["MPName"].ToString(); } if (row["PhoneNumber"] != null) { model.PhoneNumber = row["PhoneNumber"].ToString(); } if (row["ReceiveTypeCode"] != null) { model.ReceiveTypeCode = row["ReceiveTypeCode"].ToString(); } if (row["IsForBid"] != null) { model.IsForBid = row["IsForBid"].ToString(); } } return model; }
public Model.TT_CollierySupervise GetModel(Model.TT_CollierySupervise t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CSCode,CollCode,MCode,MPName,PhoneNumber,ReceiveTypeCode,IsForBid from TT_CollierySupervise "); strSql.Append(" where CSCode=@CSCode "); SqlParameter[] parameters = { new SqlParameter("@CSCode", SqlDbType.VarChar,4) }; parameters[0].Value = t.CSCode; TDTK.PlatForm.MVC4.Model.TT_CollierySupervise model = new TDTK.PlatForm.MVC4.Model.TT_CollierySupervise(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }