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; using System.Transactions; namespace CY.SQLDAL { public class Info_AllianceBasicDAL : IInfo_AllianceBasicDAL { private Database _dataBase = null; public Info_AllianceBasicDAL() { _dataBase = new Database(); } public Info_AllianceBasicDAL(Database database) { _dataBase = database; } /// /// 新增 /// /// /// public bool InserModel(Infrastructure.Domain.IAggregateRoot model) { Model.Info_AllianceBasic trueModel = model as Model.Info_AllianceBasic; if (trueModel == null) { return false; } IList sqlParms = new List() { new SqlParameter("@B_AllianceAdvantage",trueModel.B_AllianceAdvantage), new SqlParameter("@B_ConditionsCooperation",trueModel.B_ConditionsCooperation), new SqlParameter("@B_AllianceFoot",trueModel.B_AllianceFoot), new SqlParameter("@B_ContactPeople",trueModel.B_ContactPeople), new SqlParameter("@B_ContactPhone",trueModel.B_ContactPhone), new SqlParameter("@B_ContactEmail",trueModel.B_ContactEmail), new SqlParameter("@B_ContactQQ",trueModel.B_ContactQQ), new SqlParameter("@LastUpdateTime",trueModel.LastUpdateTime), new SqlParameter("@Operator",trueModel.Operator), new SqlParameter("@Process",trueModel.Process) }; try { _dataBase.Query("sp_Info_AllianceBasic_Insert", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { throw ex; } return true; } /// /// 修改 /// /// /// public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model) { Model.Info_AllianceBasic trueModel = model as Model.Info_AllianceBasic; if (trueModel == null) { return false; } IList sqlParms = new List() { new SqlParameter("@Keyid",trueModel.Keyid), new SqlParameter("@B_AllianceAdvantage",trueModel.B_AllianceAdvantage), new SqlParameter("@B_ConditionsCooperation",trueModel.B_ConditionsCooperation), new SqlParameter("@B_AllianceFoot",trueModel.B_AllianceFoot), new SqlParameter("@B_ContactPeople",trueModel.B_ContactPeople), new SqlParameter("@B_ContactPhone",trueModel.B_ContactPhone), new SqlParameter("@B_ContactEmail",trueModel.B_ContactEmail), new SqlParameter("@B_ContactQQ",trueModel.B_ContactQQ), new SqlParameter("@LastUpdateTime",trueModel.LastUpdateTime), new SqlParameter("@Operator",trueModel.Operator), new SqlParameter("@Process",trueModel.Process) }; try { _dataBase.Query("sp_Info_AllianceBasic_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { throw ex; } return true; } /// /// 删除 /// /// /// public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model) { Model.Info_AllianceBasic trueModel = model as Model.Info_AllianceBasic; if (trueModel == null) { return false; } IList sqlParms = new List() { new SqlParameter("@Keyid",trueModel.Keyid) }; try { _dataBase.Query("sp_Info_AllianceBasic_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 IEnumerable SelectModelPage(Infrastructure.Query.Pagination pagination) { try { string condtion = " 1=1 "; //TypeName IList result = _dataBase.SelectModelPage(pagination, " a.*,d.Name as LocationRemark,b.AP_Title as LocationName,b.AP_WidePixels as AP_WidePixels,b.AP_HighPixels as AP_HighPixels,c.Name as UserName ", " Info_AllianceBasic as a left join Info_AllianceBasicLoction as b on a.AdLocationId = b.Keyid left join EC_MemberBasic as c on a.A_MemberId = c.MemberId left join Sys_Dictionary as d on b.Remark = d.MeanValue and d.DicType ='网站广告位置版块' ", " b.Remark ASC,A_StartTime ASC ", "", condtion) as IList;//执行查询 return null == result ? null : result;//返回结果 } catch (Exception ex) { throw ex; } } /// /// 查询信息 /// /// public Info_AllianceBasic SelectModel() { Info_AllianceBasic m_Info_AllianceBasic = new Info_AllianceBasic(); try { IList result = _dataBase.SelectModel(" * ", " Info_AllianceBasic ") as IList;//执行查询 if (null == result || result.Count == 0) { m_Info_AllianceBasic = new Info_AllianceBasic(); } else { m_Info_AllianceBasic = result[0]; } } catch (Exception ex) { throw ex; } return m_Info_AllianceBasic; } } }