/// <summary> /// 获取系统类型定义实体集合 /// </summary> /// <param name="FieldType">类型的类型(必须传值)</param> /// <param name="IsEnabled">是否启用(为null不作条件)</param> /// <param name="IsDefault">是否系统预定义类型(为null不作条件)</param> /// <returns>系统类型定义实体集合</returns> public virtual IList <EyouSoft.Model.SystemStructure.SysFieldBase> GetSysFieldBaseList( EyouSoft.Model.SystemStructure.SysFieldType FieldType, bool?IsEnabled, bool?IsDefault) { IList <EyouSoft.Model.SystemStructure.SysFieldBase> List = new List <EyouSoft.Model.SystemStructure.SysFieldBase>(); string strWhere = Sql_SysField_Select + string.Format(" where FieldType = {0} ", (int)FieldType); if (IsEnabled != null) { strWhere += string.Format(" and IsEnabled = '{0}' ", (bool)IsEnabled ? 1 : 0); } if (IsDefault != null) { strWhere += string.Format(" and IsDefault = '{0}' ", (bool)IsDefault ? 1 : 0); } DbCommand dc = base.SystemStore.GetSqlStringCommand(strWhere); using (IDataReader dr = DbHelper.ExecuteReader(dc, base.SystemStore)) { EyouSoft.Model.SystemStructure.SysFieldBase model = null; while (dr.Read()) { model = new EyouSoft.Model.SystemStructure.SysFieldBase(); model.FieldName = dr["FieldName"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("FieldID"))) { model.FieldId = int.Parse(dr["FieldID"].ToString()); } List.Add(model); model = null; } } if (FieldType == EyouSoft.Model.SystemStructure.SysFieldType.客户等级) { EyouSoft.Model.SystemStructure.SysFieldBase model = new EyouSoft.Model.SystemStructure.SysFieldBase(); List <EyouSoft.Model.SystemStructure.SysFieldBase> newList = List.Where(item => (item.FieldName == "单房差")).ToList(); if (newList != null && newList.Count > 0) { model = newList[0]; } newList = null; List.Remove(model); List.Add(model); model = null; } return(List); }
/// <summary> /// 设置是否启用 /// </summary> /// <param name="FieldIds">系统类型定义ID集合</param> /// <param name="FieldType">系统类型定义类型</param> /// <param name="IsEnabled">是否启用</param> /// <returns>返回操作是否成功</returns> public virtual bool SetIsEnabled(string FieldIds, EyouSoft.Model.SystemStructure.SysFieldType FieldType, bool IsEnabled) { if (string.IsNullOrEmpty(FieldIds)) { return(false); } string strWhere = " update [tbl_SysField] set [IsEnabled] = '{0}' where [FieldID] in ({1}) and FieldType = {2} "; strWhere = string.Format(strWhere, IsEnabled ? "1" : "0", FieldIds, (int)FieldType); DbCommand dc = base.SystemStore.GetSqlStringCommand(strWhere); int Result = DbHelper.ExecuteSql(dc, base.SystemStore); if (Result > 0) { return(true); } else { return(false); } }
/// <summary> /// 设置是否启用 /// </summary> /// <param name="FieldId">系统类型定义ID集合</param> /// <param name="FieldType">系统类型定义类型</param> /// <param name="IsEnabled">是否启用</param> /// <returns>返回操作是否成功</returns> public bool SetIsEnabled(int[] FieldId, EyouSoft.Model.SystemStructure.SysFieldType FieldType, bool IsEnabled) { if (FieldId == null || FieldId.Length <= 0) { return(false); } string strFieldIds = string.Empty; foreach (int i in FieldId) { strFieldIds += i.ToString() + ","; } strFieldIds = strFieldIds.TrimEnd(','); bool Result = dal.SetIsEnabled(strFieldIds, FieldType, IsEnabled); if (Result) { RemoveCache(FieldType); } return(Result); }
/// <summary> /// 获取系统类型定义列表 /// </summary> /// <param name="SysFieldType">系统类型定义的类型</param> /// <returns>系统类型定义集合</returns> private IList <Model.SystemStructure.SysFieldBase> GetSysField(EyouSoft.Model.SystemStructure.SysFieldType SysFieldType) { IList <Model.SystemStructure.SysFieldBase> List = new List <Model.SystemStructure.SysFieldBase>(); string strTag = string.Empty; switch (SysFieldType) { case EyouSoft.Model.SystemStructure.SysFieldType.景点主题: strTag = EyouSoft.CacheTag.System.SightTheme; break; case EyouSoft.Model.SystemStructure.SysFieldType.客户等级: strTag = EyouSoft.CacheTag.System.CustomerLevel; break; case EyouSoft.Model.SystemStructure.SysFieldType.线路主题: strTag = EyouSoft.CacheTag.System.RouteTheme; break; case EyouSoft.Model.SystemStructure.SysFieldType.周边环境: strTag = EyouSoft.CacheTag.System.HotelArea; break; } object CacheList = EyouSoft.Cache.Facade.EyouSoftCache.GetCache(strTag); if (CacheList == null) { List = dal.GetSysFieldBaseList(SysFieldType, true, null); EyouSoft.Cache.Facade.EyouSoftCache.Add(strTag, List); } else { List = (IList <Model.SystemStructure.SysFieldBase>)CacheList; } return(List); }
/// <summary> /// 移除缓存项 /// </summary> /// <param name="SysFieldType">系统类型定义的类型</param> private void RemoveCache(EyouSoft.Model.SystemStructure.SysFieldType SysFieldType) { string strTag = string.Empty; switch (SysFieldType) { case EyouSoft.Model.SystemStructure.SysFieldType.景点主题: strTag = EyouSoft.CacheTag.System.SightTheme; break; case EyouSoft.Model.SystemStructure.SysFieldType.客户等级: strTag = EyouSoft.CacheTag.System.CustomerLevel; break; case EyouSoft.Model.SystemStructure.SysFieldType.线路主题: strTag = EyouSoft.CacheTag.System.RouteTheme; break; case EyouSoft.Model.SystemStructure.SysFieldType.周边环境: strTag = EyouSoft.CacheTag.System.HotelArea; break; } EyouSoft.Cache.Facade.EyouSoftCache.Remove(strTag); }
/// <summary> /// 获取供应商的标签(景点主题,酒店周边环境) /// </summary> /// <param name="CompanyId"></param> /// <param name="fieldtype"></param> /// <returns></returns> private IList <EyouSoft.Model.CompanyStructure.CompanyTag> GetCompanyTags(string CompanyId, EyouSoft.Model.SystemStructure.SysFieldType fieldtype) { IList <EyouSoft.Model.CompanyStructure.CompanyTag> list = new List <EyouSoft.Model.CompanyStructure.CompanyTag>(); string strSql = "select TagId,TagName from tbl_CompanyTag where CompanyId=@CompanyId and ClassId=@ClassId "; DbCommand dc = this._database.GetSqlStringCommand(strSql); this._database.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, CompanyId); this._database.AddInParameter(dc, "ClassId", DbType.Int32, (int)fieldtype); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database)) { while (dr.Read()) { EyouSoft.Model.CompanyStructure.CompanyTag model = new EyouSoft.Model.CompanyStructure.CompanyTag(); model.FieldId = dr.GetInt32(0); model.FieldName = dr.GetString(1); list.Add(model); model = null; } } return(list); }