/// <summary> /// 增加一条数据 /// </summary> /// <param name="model">model对象</param> public int Add(ClassLibrary.Model.Orders model) { return(dal.Add(model)); }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="strWhere">条件</param> /// <returns>Orders集合</returns> public List <ClassLibrary.Model.Orders> GetModelList(string strWhere) { DataTable dt = GetData(strWhere); List <ClassLibrary.Model.Orders> modelList = new List <ClassLibrary.Model.Orders>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ClassLibrary.Model.Orders model; for (int n = 0; n < rowsCount; n++) { model = new ClassLibrary.Model.Orders(); if (dt.Rows[n]["OrderNumber"] != DBNull.Value) { model.OrderNumber = Convert.ToString(dt.Rows[n]["OrderNumber"]); } if (dt.Rows[n]["UserName"] != DBNull.Value) { model.UserName = Convert.ToString(dt.Rows[n]["UserName"]); } if (dt.Rows[n]["proQuantity"] != DBNull.Value) { model.proQuantity = Convert.ToString(dt.Rows[n]["proQuantity"]); } if (dt.Rows[n]["proTotalPrice"] != DBNull.Value) { model.proTotalPrice = Convert.ToDecimal(dt.Rows[n]["proTotalPrice"]); } if (dt.Rows[n]["Linkman"] != DBNull.Value) { model.Linkman = Convert.ToString(dt.Rows[n]["Linkman"]); } if (dt.Rows[n]["Fax"] != DBNull.Value) { model.Fax = Convert.ToString(dt.Rows[n]["Fax"]); } if (dt.Rows[n]["Mobile"] != DBNull.Value) { model.Mobile = Convert.ToString(dt.Rows[n]["Mobile"]); } if (dt.Rows[n]["Telphone"] != DBNull.Value) { model.Telphone = Convert.ToString(dt.Rows[n]["Telphone"]); } if (dt.Rows[n]["Email"] != DBNull.Value) { model.Email = Convert.ToString(dt.Rows[n]["Email"]); } if (dt.Rows[n]["IdentityCard"] != DBNull.Value) { model.IdentityCard = Convert.ToString(dt.Rows[n]["IdentityCard"]); } if (dt.Rows[n]["ContractType"] != DBNull.Value) { model.ContractType = Convert.ToString(dt.Rows[n]["ContractType"]); } if (dt.Rows[n]["Payment"] != DBNull.Value) { model.Payment = Convert.ToString(dt.Rows[n]["Payment"]); } if (dt.Rows[n]["Remark"] != DBNull.Value) { model.Remark = Convert.ToString(dt.Rows[n]["Remark"]); } if (dt.Rows[n]["Status"] != DBNull.Value) { model.Status = Convert.ToString(dt.Rows[n]["Status"]); } if (dt.Rows[n]["CreatedTime"] != DBNull.Value) { model.CreatedTime = Convert.ToDateTime(dt.Rows[n]["CreatedTime"]); } modelList.Add(model); } } return(modelList); }