/// <summary> /// 得到一个对象实体 /// </summary> public webs_YueyxShop.Model.RejectionBase DataRowToModel(DataRow row) { webs_YueyxShop.Model.RejectionBase model=new webs_YueyxShop.Model.RejectionBase(); if (row != null) { if(row["r_ID"]!=null && row["r_ID"].ToString()!="") { model.r_ID=int.Parse(row["r_ID"].ToString()); } if(row["o_ID"]!=null && row["o_ID"].ToString()!="") { model.o_ID=int.Parse(row["o_ID"].ToString()); } if(row["m_ID"]!=null && row["m_ID"].ToString()!="") { model.m_ID=int.Parse(row["m_ID"].ToString()); } if (row["r_Price"] != null && row["r_Price"].ToString() != "") { model.r_Price = decimal.Parse(row["r_Price"].ToString()); } if(row["r_Date"]!=null && row["r_Date"].ToString()!="") { model.r_Date=DateTime.Parse(row["r_Date"].ToString()); } if(row["r_Status"]!=null && row["r_Status"].ToString()!="") { model.r_Status=int.Parse(row["r_Status"].ToString()); } if (row["r_Code"] != null) { model.r_Code = row["r_Code"].ToString(); } if(row["r_IsDelete"]!=null && row["r_IsDelete"].ToString()!="") { if((row["r_IsDelete"].ToString()=="1")||(row["r_IsDelete"].ToString().ToLower()=="true")) { model.r_IsDelete=true; } else { model.r_IsDelete=false; } } if(row["r_Remarks"]!=null) { model.r_Remarks=row["r_Remarks"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public webs_YueyxShop.Model.RejectionBase GetModel(int r_ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 r_ID,o_ID,m_ID,r_Date,r_Status,r_IsDelete,r_Remarks,r_Price,r_Code from RejectionBase "); strSql.Append(" where r_ID=@r_ID"); SqlParameter[] parameters = { new SqlParameter("@r_ID", SqlDbType.Int,4) }; parameters[0].Value = r_ID; webs_YueyxShop.Model.RejectionBase model=new webs_YueyxShop.Model.RejectionBase(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }