/// <summary> /// 得到一个对象实体 /// </summary> public Express.Model.SendOrderView GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from SendOrderView "); strSql.Append(" where Id=@Id "); OleDbParameter[] parameters = { new OleDbParameter("@Id", OleDbType.Integer, 4) }; parameters[0].Value = Id; Express.Model.SendOrderView model = new Express.Model.SendOrderView(); DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Express.Model.SendOrderView DataRowToModel(DataRow row) { Express.Model.SendOrderView model = new Express.Model.SendOrderView(); if (row != null) { if (row["Id"] != null && row["Id"].ToString() != "") { model.Id = int.Parse(row["Id"].ToString()); } if (row["OrderNo"] != null) { model.OrderNo = row["OrderNo"].ToString(); } if (row["Daterecived"] != null && row["Daterecived"].ToString() != "") { model.Daterecived = DateTime.Parse(row["Daterecived"].ToString()); } if (row["SalesmanID"] != null && row["SalesmanID"].ToString() != "") { model.SalesmanID = int.Parse(row["SalesmanID"].ToString()); } if (row["CustomerID"] != null && row["CustomerID"].ToString() != "") { model.CustomerID = int.Parse(row["CustomerID"].ToString()); } if (row["Tel"] != null) { model.Tel = row["Tel"].ToString(); } if (row["Provice"] != null) { model.Provice = row["Provice"].ToString(); } if (row["City"] != null) { model.City = row["City"].ToString(); } if (row["Area"] != null) { model.Area = row["Area"].ToString(); } if (row["Address"] != null) { model.Address = row["Address"].ToString(); } if (row["Reciver"] != null) { model.Reciver = row["Reciver"].ToString(); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } if (row["Contractor"] != null) { model.Contractor = row["Contractor"].ToString(); } if (row["Contractdate"] != null && row["Contractdate"].ToString() != "") { model.Contractdate = DateTime.Parse(row["Contractdate"].ToString()); } if (row["OState"] != null && row["OState"].ToString() != "") { model.OState = int.Parse(row["OState"].ToString()); } if (row["Merchandiser"] != null && row["Merchandiser"].ToString() != "") { model.Merchandiser = int.Parse(row["Merchandiser"].ToString()); } if (row["UserDate"] != null && row["UserDate"].ToString() != "") { model.UserDate = DateTime.Parse(row["UserDate"].ToString()); } if (row["OperUser"] != null) { model.OperUser = row["OperUser"].ToString(); } if (row["ORState"] != null && row["ORState"].ToString() != "") { model.ORState = int.Parse(row["ORState"].ToString()); } if (row["Paream0"] != null) { model.Paream0 = row["Paream0"].ToString(); } if (row["Paream1"] != null) { model.Paream1 = row["Paream1"].ToString(); } if (row["Paream2"] != null) { model.Paream2 = row["Paream2"].ToString(); } if (row["Paream3"] != null) { model.Paream3 = row["Paream3"].ToString(); } if (row["Paream4"] != null) { model.Paream4 = row["Paream4"].ToString(); } if (row["Paream5"] != null && row["Paream5"].ToString() != "") { model.Paream5 = int.Parse(row["Paream5"].ToString()); } if (row["Paream6"] != null && row["Paream6"].ToString() != "") { model.Paream6 = int.Parse(row["Paream6"].ToString()); } if (row["Paream7"] != null && row["Paream7"].ToString() != "") { model.Paream7 = int.Parse(row["Paream7"].ToString()); } if (row["Paream8"] != null && row["Paream8"].ToString() != "") { model.Paream8 = int.Parse(row["Paream8"].ToString()); } if (row["NewContractdate"] != null) { model.NewContractdate = row["NewContractdate"].ToString(); } if (row["OStateName"] != null) { model.OStateName = row["OStateName"].ToString(); } if (row["ORStateName"] != null) { model.ORStateName = row["ORStateName"].ToString(); } if (row["cusname"] != null) { model.cusname = row["cusname"].ToString(); } if (row["pername"] != null) { model.pername = row["pername"].ToString(); } } return(model); }