/// <summary> /// 获得数据列表 /// </summary> public List <NoName.NetShop.Model.AddressModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List <NoName.NetShop.Model.AddressModel> modelList = new List <NoName.NetShop.Model.AddressModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.AddressModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.AddressModel(); if (ds.Tables[0].Rows[n]["UserId"].ToString() != "") { model.UserId = int.Parse(ds.Tables[0].Rows[n]["UserId"].ToString()); } if (ds.Tables[0].Rows[n]["AddressId"].ToString() != "") { model.AddressId = int.Parse(ds.Tables[0].Rows[n]["AddressId"].ToString()); } model.Province = ds.Tables[0].Rows[n]["Province"].ToString(); model.City = ds.Tables[0].Rows[n]["City"].ToString(); model.AddressDetail = ds.Tables[0].Rows[n]["AddressDetail"].ToString(); model.RecieverName = ds.Tables[0].Rows[n]["RecieverName"].ToString(); model.Mobile = ds.Tables[0].Rows[n]["Mobile"].ToString(); model.Telephone = ds.Tables[0].Rows[n]["Telephone"].ToString(); model.Postalcode = ds.Tables[0].Rows[n]["Postalcode"].ToString(); if (ds.Tables[0].Rows[n]["IsDefault"].ToString() != "") { if ((ds.Tables[0].Rows[n]["IsDefault"].ToString() == "1") || (ds.Tables[0].Rows[n]["IsDefault"].ToString().ToLower() == "true")) { model.IsDefault = true; } else { model.IsDefault = false; } } if (ds.Tables[0].Rows[n]["InsertTime"].ToString() != "") { model.InsertTime = DateTime.Parse(ds.Tables[0].Rows[n]["InsertTime"].ToString()); } if (ds.Tables[0].Rows[n]["ModifyTime"].ToString() != "") { model.ModifyTime = DateTime.Parse(ds.Tables[0].Rows[n]["ModifyTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// ��������б� /// </summary> public List<NoName.NetShop.Model.AddressModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<NoName.NetShop.Model.AddressModel> modelList = new List<NoName.NetShop.Model.AddressModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.AddressModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.AddressModel(); if(ds.Tables[0].Rows[n]["UserId"].ToString()!="") { model.UserId=int.Parse(ds.Tables[0].Rows[n]["UserId"].ToString()); } if(ds.Tables[0].Rows[n]["AddressId"].ToString()!="") { model.AddressId=int.Parse(ds.Tables[0].Rows[n]["AddressId"].ToString()); } model.Province=ds.Tables[0].Rows[n]["Province"].ToString(); model.City=ds.Tables[0].Rows[n]["City"].ToString(); model.AddressDetail=ds.Tables[0].Rows[n]["AddressDetail"].ToString(); model.RecieverName=ds.Tables[0].Rows[n]["RecieverName"].ToString(); model.Mobile=ds.Tables[0].Rows[n]["Mobile"].ToString(); model.Telephone=ds.Tables[0].Rows[n]["Telephone"].ToString(); model.Postalcode=ds.Tables[0].Rows[n]["Postalcode"].ToString(); if(ds.Tables[0].Rows[n]["IsDefault"].ToString()!="") { if((ds.Tables[0].Rows[n]["IsDefault"].ToString()=="1")||(ds.Tables[0].Rows[n]["IsDefault"].ToString().ToLower()=="true")) { model.IsDefault=true; } else { model.IsDefault=false; } } if(ds.Tables[0].Rows[n]["InsertTime"].ToString()!="") { model.InsertTime=DateTime.Parse(ds.Tables[0].Rows[n]["InsertTime"].ToString()); } if(ds.Tables[0].Rows[n]["ModifyTime"].ToString()!="") { model.ModifyTime=DateTime.Parse(ds.Tables[0].Rows[n]["ModifyTime"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.AddressModel model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(NoName.NetShop.Model.AddressModel model) { dal.Add(model); }