Beispiel #1
0
        public static bool HasUsePlatformConfig(Guid oemId, ConfigUseType type)
        {
            if (oemId == Guid.Empty)
            {
                return(true);
            }

            var config = OEMAirlineConfigService.QueryConfig(oemId);

            if (config.Config.ContainsKey(type))
            {
                return(false);
            }
            else
            {
                if (OEMService.QueryOEMById(oemId).UseB3BConfig)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 根据给出的OEM编号和类型,得到其Office号;
        /// </summary>
        /// <param name="oemId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private static string GetOfficeNumber(Guid oemId, ConfigUseType type)
        {
            var config       = OEMAirlineConfigService.QueryConfig(oemId);
            var officeNumber = config.Config.ContainsKey(type) ? config.Config[type].Item2 : null;

            if (string.IsNullOrEmpty(officeNumber) && OEMService.QueryOEMById(oemId).UseB3BConfig)
            {
                config       = OEMAirlineConfigService.QueryConfig(Guid.Empty);
                officeNumber = config.Config.ContainsKey(type) ? config.Config[type].Item2 : null;
            }

            return(officeNumber);
        }
        protected void btnSaveConfig_Click(object sender, EventArgs e)
        {
            var config = new Dictionary <ConfigUseType, Tuple <string, string> >();

            foreach (RepeaterItem item in SettingList.Items)
            {
                var type     = item.FindControl("hdUserTypeValue") as HiddenField;
                var userName = item.FindControl("txtUserName") as TextBox;
                var officeNO = item.FindControl("txtOfficeNO") as TextBox;
                if (type != null)
                {
                    config.Add((ConfigUseType)int.Parse(type.Value.Trim()), new Tuple <string, string>(userName.Text.Trim(), officeNO.Text.Trim()));
                }
            }
            var success = OEMAirlineConfigService.SaveConfig(PlatformId.Value, config, CurrentUser.UserName);

            ClientScript.RegisterStartupScript(GetType(), "successTip", "alert('保存成功!')", true);
        }
Beispiel #4
0
        // 注意,这里的流量统计不是很准确,是否要在那边记录一个值,看指令是否执行;
        // 还有,清Q时结束的话,如果没有获取到,不会并发问题吧?

        /// <summary>
        /// 根据给出的OEM编号和类型,得到PID用户名;
        /// </summary>
        /// <param name="oemId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private static string GetUserName(Guid oemId, ConfigUseType type)
        {
            // 取得配置信息;
            var config = OEMAirlineConfigService.QueryConfig(oemId);
            // 在配置信息中查找指定类型的配置,若存在,赋值,否则为空;
            var userName = config.Config.ContainsKey(type) ? config.Config[type].Item1 : null;

            if (userName == string.Empty)
            {
                return(null);
            }

            // 若用户名为空,但要求使用平台配置,则此时取得平台配置;
            if (userName == null && OEMService.QueryOEMById(oemId).UseB3BConfig)
            {
                config   = OEMAirlineConfigService.QueryConfig(Guid.Empty);
                userName = config.Config.ContainsKey(type) ? config.Config[type].Item1 : null;
            }

            return(userName);
        }
        private void LoadOEMConfigs(Guid?oemId)
        {
            if (oemId == null)
            {
                return;
            }
            var config = OEMAirlineConfigService.QueryConfig(oemId) ?? new OEMAirlineConfig()
            {
                Config = new Dictionary <ConfigUseType, Tuple <string, string> >()
            };
            var configUserTypes = from ConfigUseType u in Enum.GetValues(typeof(ConfigUseType))
                                  select new
            {
                UseType      = u.GetDescription(),
                UseTypeValue = (byte)u,
                UserName     = config.Config.ContainsKey(u) ?
                               config.Config[u].Item1 : string.Empty,
                OfficeNO = config.Config.ContainsKey(u) ?
                           config.Config[u].Item2 : string.Empty
            };

            SettingList.DataSource = configUserTypes;
            SettingList.DataBind();
        }