/// <summary> /// 得到一个对象实体 /// </summary> public KSOA.Model.UI_ExcelImportByPlatform DataRowToModel(DataRow row) { KSOA.Model.UI_ExcelImportByPlatform model=new KSOA.Model.UI_ExcelImportByPlatform(); if (row != null) { if(row["ID"]!=null && row["ID"].ToString()!="") { model.ID=int.Parse(row["ID"].ToString()); } if(row["CustomerID"]!=null && row["CustomerID"].ToString()!="") { model.CustomerID=int.Parse(row["CustomerID"].ToString()); } if(row["ExType"]!=null) { model.ExType=row["ExType"].ToString(); } if(row["ExTime"]!=null && row["ExTime"].ToString()!="") { model.ExTime=DateTime.Parse(row["ExTime"].ToString()); } if(row["ExCpName"]!=null) { model.ExCpName=row["ExCpName"].ToString(); } if(row["ExOpusName"]!=null) { model.ExOpusName=row["ExOpusName"].ToString(); } if(row["ExCooperation"]!=null) { model.ExCooperation=row["ExCooperation"].ToString(); } if(row["ExCollectNum"]!=null && row["ExCollectNum"].ToString()!="") { model.ExCollectNum=int.Parse(row["ExCollectNum"].ToString()); } if(row["ExSingleCollectNum"]!=null && row["ExSingleCollectNum"].ToString()!="") { model.ExSingleCollectNum=int.Parse(row["ExSingleCollectNum"].ToString()); } if(row["ExOpusUnitPrice"]!=null && row["ExOpusUnitPrice"].ToString()!="") { model.ExOpusUnitPrice=decimal.Parse(row["ExOpusUnitPrice"].ToString()); } if(row["ExAccountPrice"]!=null && row["ExAccountPrice"].ToString()!="") { model.ExAccountPrice=decimal.Parse(row["ExAccountPrice"].ToString()); } if(row["AddTime"]!=null && row["AddTime"].ToString()!="") { model.AddTime=DateTime.Parse(row["AddTime"].ToString()); } if(row["IsDelete"]!=null && row["IsDelete"].ToString()!="") { if((row["IsDelete"].ToString()=="1")||(row["IsDelete"].ToString().ToLower()=="true")) { model.IsDelete=true; } else { model.IsDelete=false; } } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public KSOA.Model.UI_ExcelImportByPlatform GetModel(int ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,CustomerID,ExType,ExTime,ExCpName,ExOpusName,ExCooperation,ExCollectNum,ExSingleCollectNum,ExOpusUnitPrice,ExAccountPrice,AddTime,IsDelete from UI_ExcelImportByPlatform "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4) }; parameters[0].Value = ID; KSOA.Model.UI_ExcelImportByPlatform model=new KSOA.Model.UI_ExcelImportByPlatform(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }