/// <summary> /// 得到一个对象实体 /// </summary> public DataService.Model.v_OrderDetail GetModel(int OrderDetailID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 OrderDetailID,OrderID,ProTypeID,Spec,PlanNum,Price,total,Remark,FinishNum,OrderStatus,UpTime,TypeName,ProName,SendArea,RealArea from v_OrderDetail "); strSql.Append(" where OrderDetailID=@OrderDetailID "); SqlParameter[] parameters = { new SqlParameter("@OrderDetailID", SqlDbType.Int, 4) }; parameters[0].Value = OrderDetailID; DataService.Model.v_OrderDetail model = new DataService.Model.v_OrderDetail(); 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 DataService.Model.v_OrderDetail DataRowToModel(DataRow row) { DataService.Model.v_OrderDetail model = new DataService.Model.v_OrderDetail(); if (row != null) { if (row["OrderDetailID"] != null && row["OrderDetailID"].ToString() != "") { model.OrderDetailID = int.Parse(row["OrderDetailID"].ToString()); } if (row["OrderID"] != null && row["OrderID"].ToString() != "") { model.OrderID = int.Parse(row["OrderID"].ToString()); } if (row["ProTypeID"] != null && row["ProTypeID"].ToString() != "") { model.ProTypeID = int.Parse(row["ProTypeID"].ToString()); } if (row["Spec"] != null) { model.Spec = row["Spec"].ToString(); } if (row["PlanNum"] != null && row["PlanNum"].ToString() != "") { model.PlanNum = decimal.Parse(row["PlanNum"].ToString()); } if (row["Price"] != null && row["Price"].ToString() != "") { model.Price = decimal.Parse(row["Price"].ToString()); } if (row["total"] != null && row["total"].ToString() != "") { model.total = decimal.Parse(row["total"].ToString()); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } if (row["FinishNum"] != null && row["FinishNum"].ToString() != "") { model.FinishNum = decimal.Parse(row["FinishNum"].ToString()); } if (row["OrderStatus"] != null && row["OrderStatus"].ToString() != "") { model.OrderStatus = int.Parse(row["OrderStatus"].ToString()); } if (row["UpTime"] != null && row["UpTime"].ToString() != "") { model.UpTime = DateTime.Parse(row["UpTime"].ToString()); } if (row["TypeName"] != null) { model.TypeName = row["TypeName"].ToString(); } if (row["ProName"] != null) { model.ProName = row["ProName"].ToString(); } if (row["SendArea"] != null && row["SendArea"].ToString() != "") { model.SendArea = decimal.Parse(row["SendArea"].ToString()); } if (row["RealArea"] != null && row["RealArea"].ToString() != "") { model.RealArea = decimal.Parse(row["RealArea"].ToString()); } } return(model); }