/// <summary> /// 得到一个对象实体 /// </summary> public KSOA.Model.UI_ExcelImportByChannel DataRowToModel(DataRow row) { KSOA.Model.UI_ExcelImportByChannel model=new KSOA.Model.UI_ExcelImportByChannel(); 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["ExSpreadType"]!=null) { model.ExSpreadType=row["ExSpreadType"].ToString(); } if(row["ExTime"]!=null && row["ExTime"].ToString()!="") { model.ExTime=DateTime.Parse(row["ExTime"].ToString()); } if(row["ExOpusName"]!=null) { model.ExOpusName=row["ExOpusName"].ToString(); } if(row["ExCollectNum"]!=null && row["ExCollectNum"].ToString()!="") { model.ExCollectNum=int.Parse(row["ExCollectNum"].ToString()); } if(row["ExChargeCollectNum"]!=null && row["ExChargeCollectNum"].ToString()!="") { model.ExChargeCollectNum=int.Parse(row["ExChargeCollectNum"].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["ExAccountCollectNum"]!=null && row["ExAccountCollectNum"].ToString()!="") { model.ExAccountCollectNum=int.Parse(row["ExAccountCollectNum"].ToString()); } if(row["HistoryPercent"]!=null) { model.HistoryPercent=row["HistoryPercent"].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_ExcelImportByChannel GetModel(int ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,CustomerID,ExSpreadType,ExTime,ExOpusName,ExCollectNum,ExChargeCollectNum,ExOpusUnitPrice,ExAccountPrice,ExAccountCollectNum,HistoryPercent,AddTime,IsDelete from UI_ExcelImportByChannel "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4) }; parameters[0].Value = ID; KSOA.Model.UI_ExcelImportByChannel model=new KSOA.Model.UI_ExcelImportByChannel(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }