/*/// <summary> * /// 获取公司配置信息 * /// </summary> * /// <param name="company">公司编号</param> * /// <returns>配置实体</returns> * public MComSetting GetModel(string company) * { * DbCommand cmd = this._db.GetSqlStringCommand(SQL_SELECT_GetSettings); * this._db.AddInParameter(cmd, "@CompanyId", DbType.AnsiStringFixedLength, company); * * MComSetting item = new MComSetting(); * item.PrintDocument = new List<PrintDocument>(); * item.SmsConfig = new MSmsConfigInfo(); * * using (IDataReader reader = DbHelper.ExecuteReader(cmd, this._db)) * { * while (reader.Read()) * { * string key = reader["Key"].ToString(); * string value = reader["value"].ToString(); * * if (string.IsNullOrEmpty(key)) continue; * #region 单据配置键处理 * //单据配置的key为枚举+'_' * if (key.IndexOf(string.Format("{0}_", (int)SysConfiguration.单据配置)) == 0) * { * string printTemplateType = key.Substring(string.Format("{0}_", (int)SysConfiguration.单据配置).Length); * item.PrintDocument.Add(new PrintDocument() * { * PrintTemplate = value, * PrintTemplateType = (PrintTemplateType)Enum.Parse(typeof(PrintTemplateType), printTemplateType) * }); * continue; * } #endregion * #region 配置键为数字处理 * int? _key = EyouSoft.Toolkit.Utils.GetIntNullable(key, null); * if (_key.HasValue) * { * EyouSoft.Model.EnumType.ComStructure.SysConfiguration sysConfiguration = (SysConfiguration)_key.Value; * switch (sysConfiguration) * { * case SysConfiguration.Word模版: item.WordTemplate = value; break; * //case SysConfiguration.变更提醒: item.ChangeRemind = Utils.GetInt(value); break; * //case SysConfiguration.出团提醒: item.GroupRemind = Utils.GetInt(value); break; * //case SysConfiguration.弹窗提醒: item.PopRemind = Utils.GetInt(value); break; * //case SysConfiguration.付款提醒: item.PaymnetRemind = Utils.GetInt(value); break; * //case SysConfiguration.公告提醒: item.AnnouncementRemind = Utils.GetInt(value); break; * case SysConfiguration.公司章: item.CompanyChapter = value; break; * //case SysConfiguration.回团提醒: item.BackRemind = Utils.GetInt(value); break; * case SysConfiguration.积分比例: item.IntegralProportion = Utils.GetInt(value); break; * case SysConfiguration.计划停收出境线: item.ExitArea = Utils.GetInt(value); break; * case SysConfiguration.计划停收国内线: item.CountryArea = Utils.GetInt(value); break; * case SysConfiguration.计划停收省内线: item.ProvinceArea = Utils.GetInt(value); break; * case SysConfiguration.劳动合同到期提醒: item.ContractRemind = Utils.GetInt(value); break; * case SysConfiguration.供应商合同到期提醒: item.SContractRemind = Utils.GetInt(value); break; * case SysConfiguration.公司合同到期提醒: item.ComPanyContractRemind = Utils.GetInt(value); break; * case SysConfiguration.洒店预控到期提醒: item.HotelControlRemind = Utils.GetInt(value); break; * case SysConfiguration.车辆预控到期提醒: item.CarControlRemind = Utils.GetInt(value); break; * case SysConfiguration.游船预控到期提醒: item.ShipControlRemind = Utils.GetInt(value); break; * case SysConfiguration.列表显示控制_前几个月: item.ShowBeforeMonth = Utils.GetInt(value); break; * case SysConfiguration.列表显示控制_后几个月: item.ShowAfterMonth = Utils.GetInt(value); break; * case SysConfiguration.留位时间控制: item.SaveTime = Utils.GetInt(value); break; * case SysConfiguration.欠款额度控制: item.ArrearsRangeControl = GetBoolean(value); break; * //case SysConfiguration.生日提醒: item.BirthdayRemind = Utils.GetInt(value); break; * //case SysConfiguration.收款提醒: item.CollectionRemind = Utils.GetInt(value); break; * //case SysConfiguration.提醒时间配置: item.RemindTime = Utils.GetInt(value); break; * case SysConfiguration.跳过报账终审: item.SkipFinalJudgment = GetBoolean(value); break; * case SysConfiguration.跳过导游报账: item.SkipGuide = GetBoolean(value); break; * case SysConfiguration.跳过销售报账: item.SkipSale = GetBoolean(value); break; * case SysConfiguration.团号配置: item.TourNoSetting = value; break; * //case SysConfiguration.物品借阅到期提醒: item.BorrowingRemind = Utils.GetInt(value); break; * case SysConfiguration.页脚: item.FooterPath = value; break; * case SysConfiguration.页眉: item.PagePath = value; break; * //case SysConfiguration.询价提醒: item.InquiryRemind = Utils.GetInt(value); break; * case SysConfiguration.财务收入审核: item.FinancialIncomeReview = GetBoolean(value); break; * case SysConfiguration.财务支出审核: item.FinancialExpensesReview = GetBoolean(value); break; * //case SysConfiguration.订单毛利配置: item.OrderCost = GetBoolean(value); break; * //case SysConfiguration.下计调任务跳过: item.PlanTaskJump = GetBoolean(value); break; * //case SysConfiguration.报账配置: item.PlanGuide = Utils.GetEnumValue<PlanGuideSetting>(value, PlanGuideSetting.显示所有计调); break; * //case SysConfiguration.封团配置: item.TourClose = Utils.GetEnumValue<TourCloseSetting>(value, TourCloseSetting.单团核算结束后封团); break; * case SysConfiguration.是否开启KIS整合: item.IsEnableKis = GetBoolean(value); break; * default: break; * } * * continue; * } #endregion * #region 配置键为字符串处理 * switch (key) * { * case "SmsAccount": item.SmsConfig.Account = value; break; * case "SmsAppKey": item.SmsConfig.AppKey = value; break; * case "SmsAppSecret": item.SmsConfig.AppSecret = value; break; * } #endregion * } * * if (reader.NextResult()) * { * if (reader.Read()) * { * item.WLogo = reader["WLogo"].ToString(); * item.NLogo = reader["NLogo"].ToString(); * item.MLogo = reader["MLogo"].ToString(); * item.CompanyName = reader["Name"].ToString(); * } * } * * item.CompanyId = company; * } * * return item; * }*/ /// <summary> /// 修改公司配置信息 /// </summary> /// <param name="item">配置实体</param> /// <returns>true:成功 false:失败</returns> public bool UpdateComSetting(MComSetting item) { #region create xml //xml格式<item><val id="key">value</val></item> StringBuilder xml = new StringBuilder("<item>"); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.页眉, item.PagePath); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.页脚, item.FooterPath); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.Word模版, item.WordTemplate); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.公司章, item.CompanyChapter); //xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.积分比例, item.IntegralProportion); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.计划停收出境线, item.ExitArea); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.计划停收国内线, item.CountryArea); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.计划停收省内线, item.ProvinceArea); //xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.列表显示控制_后几个月, item.ShowAfterMonth); //xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.列表显示控制_前几个月, item.ShowBeforeMonth); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.留位时间控制, item.SaveTime); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.跳过报账终审, GetBooleanToStr(item.SkipFinalJudgment)); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.跳过导游报账, GetBooleanToStr(item.SkipGuide)); xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.跳过销售报账, GetBooleanToStr(item.SkipSale)); //xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.财务收入审核, GetBooleanToStr(item.FinancialIncomeReview)); //xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.财务支出审核, GetBooleanToStr(item.FinancialExpensesReview)); //xml.AppendFormat("<val id='{0}'>{1}</val>", (int)SysConfiguration.欠款额度控制, GetBooleanToStr(item.ArrearsRangeControl)); xml.Append("</item>"); #endregion DbCommand cmd = this._db.GetStoredProcCommand(SQL_PROC_SetSettings); _db.AddInParameter(cmd, "@CompanyId", DbType.AnsiStringFixedLength, item.CompanyId); _db.AddInParameter(cmd, "@xml", DbType.Xml, xml.ToString()); _db.AddOutParameter(cmd, "@RetCode", DbType.Int32, 4); int sqlExceptionCode = 0; try { DbHelper.RunProcedure(cmd, _db); } catch (System.Data.SqlClient.SqlException e) { sqlExceptionCode = 0 - e.Number; } if (sqlExceptionCode < 0) { return(false); } else { return(Convert.ToInt32(_db.GetParameterValue(cmd, "RetCode")) == 1); } }
/// <summary> /// 获取公司配置信息 /// </summary> /// <param name="companyId">公司编号</param> /// <returns></returns> public static MComSetting GetComSetting(string companyId) { if (string.IsNullOrEmpty(companyId)) { return(null); } string cacheName = string.Format(EyouSoft.Cache.Tag.TagName.ComSetting, companyId); MComSetting setting = (MComSetting)EyouSoft.Cache.Facade.EyouSoftCache.GetCache(cacheName); if (setting == null) { IUserLogin dal = new DUserLogin(); setting = dal.GetComSetting(companyId); EyouSoft.Cache.Facade.EyouSoftCache.Add(cacheName, setting); } return(setting); }
/// <summary> /// 修改公司配置信息 /// </summary> /// <param name="item">配置实体</param> /// <returns>true:成功 false:失败</returns> public bool UpdateComSetting(MComSetting item) { bool result = false; if (item != null) { result = dal.UpdateComSetting(item); if (result) { EyouSoft.BLL.SysStructure.BSysLogHandle.Insert("修改系统配置信息"); } string cacheName = string.Format(EyouSoft.Cache.Tag.TagName.ComSetting, item.CompanyId); if (EyouSoft.Cache.Facade.EyouSoftCache.GetCache(cacheName) != null) { EyouSoft.Cache.Facade.EyouSoftCache.Remove(cacheName); } } return(result); }
/// <summary> /// 获取公司配置信息 /// </summary> /// <param name="companyId">公司编号</param> /// <returns></returns> public MComSetting GetComSetting(string companyId) { DbCommand cmd = _db.GetSqlStringCommand(SQL_SELECT_GetSettings); _db.AddInParameter(cmd, "@CompanyId", DbType.AnsiStringFixedLength, companyId); MComSetting setting = new MComSetting(); setting.PrintDocument = new List <PrintDocument>(); setting.SmsConfig = new MSmsConfigInfo(); using (IDataReader rdr = DbHelper.ExecuteReader(cmd, _db)) { while (rdr.Read()) { string key = rdr["Key"].ToString(); string value = rdr["value"].ToString(); if (string.IsNullOrEmpty(key)) { continue; } #region 单据配置键处理 //单据配置的key为枚举+'_' if (key.IndexOf(string.Format("{0}_", (int)SysConfiguration.单据配置)) == 0) { string printTemplateType = key.Substring(string.Format("{0}_", (int)SysConfiguration.单据配置).Length); setting.PrintDocument.Add(new PrintDocument() { PrintTemplate = value, PrintTemplateType = (PrintTemplateType)Enum.Parse(typeof(PrintTemplateType), printTemplateType) }); continue; } #endregion #region 配置键为数字处理 int?_key = EyouSoft.Toolkit.Utils.GetIntNullable(key, null); if (_key.HasValue) { EyouSoft.Model.EnumType.ComStructure.SysConfiguration sysConfiguration = (SysConfiguration)_key.Value; switch (sysConfiguration) { case SysConfiguration.Word模版: setting.WordTemplate = value; break; case SysConfiguration.公司章: setting.CompanyChapter = value; break; case SysConfiguration.积分比例: setting.IntegralProportion = Utils.GetInt(value); break; case SysConfiguration.计划停收出境线: setting.ExitArea = Utils.GetInt(value); break; case SysConfiguration.计划停收国内线: setting.CountryArea = Utils.GetInt(value); break; case SysConfiguration.计划停收省内线: setting.ProvinceArea = Utils.GetInt(value); break; case SysConfiguration.劳动合同到期提醒: setting.ContractRemind = Utils.GetInt(value); break; case SysConfiguration.供应商合同到期提醒: setting.SContractRemind = Utils.GetInt(value); break; case SysConfiguration.公司合同到期提醒: setting.ComPanyContractRemind = Utils.GetInt(value); break; case SysConfiguration.洒店预控到期提醒: setting.HotelControlRemind = Utils.GetInt(value); break; case SysConfiguration.车辆预控到期提醒: setting.CarControlRemind = Utils.GetInt(value); break; case SysConfiguration.游船预控到期提醒: setting.ShipControlRemind = Utils.GetInt(value); break; case SysConfiguration.景点预控到期提醒: setting.SightControlRemind = Utils.GetInt(value); break; case SysConfiguration.其他预控到期提醒: setting.OtherControlRemind = Utils.GetInt(value); break; case SysConfiguration.列表显示控制_前几个月: setting.ShowBeforeMonth = Utils.GetInt(value); break; case SysConfiguration.列表显示控制_后几个月: setting.ShowAfterMonth = Utils.GetInt(value); break; case SysConfiguration.留位时间控制: setting.SaveTime = Utils.GetInt(value); break; case SysConfiguration.款额度控制: setting.ArrearsRangeControl = GetBoolean(value); break; case SysConfiguration.跳过报账终审: setting.SkipFinalJudgment = GetBoolean(value); break; case SysConfiguration.跳过导游报账: setting.SkipGuide = GetBoolean(value); break; case SysConfiguration.跳过销售报账: setting.SkipSale = GetBoolean(value); break; case SysConfiguration.团号配置: setting.TourNoSetting = value; break; case SysConfiguration.页脚: setting.FooterPath = value; break; case SysConfiguration.页眉: setting.PagePath = value; break; case SysConfiguration.财务收入审核: setting.FinancialIncomeReview = GetBoolean(value); break; case SysConfiguration.财务支出审核: setting.FinancialExpensesReview = GetBoolean(value); break; case SysConfiguration.是否开启KIS整合: setting.IsEnableKis = GetBoolean(value); break; default: break; } continue; } #endregion #region 配置键为字符串处理 switch (key) { case "SmsAccount": setting.SmsConfig.Account = value; break; case "SmsAppKey": setting.SmsConfig.AppKey = value; break; case "SmsAppSecret": setting.SmsConfig.AppSecret = value; break; case "MaxUserNumber": setting.MaxUserNumber = Utils.GetInt(value); break; case "UserLoginLimitType": setting.UserLoginLimitType = Utils.GetEnumValue <EyouSoft.Model.EnumType.ComStructure.UserLoginLimitType>(value, UserLoginLimitType.None); break; case "IsEnableDuanXian": setting.IsEnableDuanXian = GetBoolean(value); break; case "ZiDongShanChuSanPinJiHua": setting.IsZiDongShanChuSanPinJiHua = GetBoolean(value); break; case "ShouKuanZhiFuFangShi": setting.ShouKuanZhiFuFangShi = Utils.GetInt(value); break; case "FuKuanZhiFuFangShi": setting.FuKuanZhiFuFangShi = Utils.GetInt(value); break; default: break; } #endregion } if (rdr.NextResult()) { if (rdr.Read()) { setting.WLogo = rdr["WLogo"].ToString(); setting.NLogo = rdr["NLogo"].ToString(); setting.MLogo = rdr["MLogo"].ToString(); setting.CompanyName = rdr["Name"].ToString(); setting.GYSLogo = rdr["GYSLogo"].ToString(); setting.FXSLogo = rdr["FXSLogo"].ToString(); } } setting.CompanyId = companyId; } return(setting); }