using System; using System.Collections.Generic; using System.Linq; using System.Text; using CY.IDAL; using System.Data.SqlClient; using System.Data; using CY.Model; namespace CY.SQLDAL { public class EC_ShopInfoDAL : IEC_ShopInfoDAL { private Database _dataBase = null; public EC_ShopInfoDAL() { _dataBase = new Database(); } public EC_ShopInfoDAL(Database database) { _dataBase = database; } /// /// 新增 /// /// /// public bool InserModel(Infrastructure.Domain.IAggregateRoot model) { Model.EC_ShopInfo trueModel = model as Model.EC_ShopInfo; if (trueModel == null) { return false; } IList sqlParms = new List() { new SqlParameter("@SellerId",trueModel.SellerId), new SqlParameter("@IdCardFileId",trueModel.IdCardFileId), new SqlParameter("@CardIdea",trueModel.CardIdea), new SqlParameter("@SellerName",trueModel.SellerName), new SqlParameter("@Sex",trueModel.Sex), new SqlParameter("@LastUpdateTime",trueModel.LastUpdateTime), new SqlParameter("@Operator",trueModel.Operator), new SqlParameter("@Remark",trueModel.Remark) }; try { _dataBase.Query("sp_EC_ShopInfo_Insert", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { throw ex; } return true; } /// /// 修改 /// /// /// public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model) { Model.EC_ShopInfo trueModel = model as Model.EC_ShopInfo; if (trueModel == null) { return false; } IList sqlParms = new List() { new SqlParameter("@Keyid",trueModel.Keyid), new SqlParameter("@SellerId",trueModel.SellerId), new SqlParameter("@IdCardFileId",trueModel.IdCardFileId), new SqlParameter("@CardIdea",trueModel.CardIdea), new SqlParameter("@SellerName",trueModel.SellerName), new SqlParameter("@Sex",trueModel.Sex), new SqlParameter("@LastUpdateTime",trueModel.LastUpdateTime), new SqlParameter("@Operator",trueModel.Operator), new SqlParameter("@Remark",trueModel.Remark) }; try { _dataBase.Query("sp_EC_ShopInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { throw ex; } return true; } /// /// 删除 /// /// /// public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model) { Model.EC_ShopInfo trueModel = model as Model.EC_ShopInfo; if (trueModel == null) { return false; } IList sqlParms = new List() { new SqlParameter("@Keyid",trueModel.Keyid) }; try { _dataBase.Query("sp_EC_ShopInfo_DeleteRow", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { throw ex; } return true; } /// /// 分页查询 /// /// /// /// public IEnumerable SelectModelPage(Infrastructure.Query.Query query, Infrastructure.Query.Pagination pagination) { throw new NotImplementedException(); } /// /// 单个查询 /// /// /// public IEnumerable SelectAllModel(Infrastructure.Query.Query query) { throw new NotImplementedException(); } /// /// 根据会员编号获得店铺信息 /// /// 会员编号 /// public EC_ShopInfo GetModelByMemberId(Guid MemberId) { if (MemberId == null) return null;//错误数据返会空 IList result = _dataBase.SelectModel("*", "EC_ShopInfo", string.Format(" SellerId='{0}'", MemberId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } } }