protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                String employerFormat = String.Empty;
                using (GetEmployerContent gecs = new GetEmployerContent(Convert.ToInt16(Request.QueryString["e"])))
                {
                    this.InsurerName = gecs.InsurerName;
                    employerFormat = gecs.MemberIDFormat;
                }
                String leftOver = employerFormat;
                //Int32 tbCount = 0;
                PageData = new List<BindData>();
                while (leftOver.Length > 0)
                {
                    BindData newBd = new BindData() { Length = 0 };

                    foreach (char c in leftOver.ToCharArray())
                    {
                        if (c == DigitIndicator || c == LetterIndicator || c == EitherIndicator)
                        {
                            newBd.Text += "X";
                            newBd.Alt += "X";
                            newBd.Length++;
                            newBd.ToolTip = newBd.Length + " character(s)";
                        }
                        else
                            break;
                    }
                    newBd.Style = String.Format("width:{0}px;padding:10px 15px;margin:10px 0px;", newBd.Length * 11);

                    leftOver = leftOver.Remove(0, newBd.Length);
                    if (leftOver.Length > 0)
                    {
                        leftOver = leftOver.Remove(0, 1);
                    }
                    PageData.Add(newBd);
                }
                rptFields.DataBind(PageData);
            }
        }
Exemple #2
0
 /// <summary>
 /// 绑定关系临时数据
 /// </summary>
 /// <param name="container">服务容器</param>
 /// <param name="bindData">服务绑定数据</param>
 internal GivenData(Container container, BindData bindData)
 {
     this.bindData  = bindData;
     this.container = container;
 }
Exemple #3
0
 internal static BindDataStorage <T> CreateBindDataStorage <T>(BindData <T> bindData = null)
 {
     bindData = bindData ?? CreateBindData <T>();
     return(BindDataStorage <T> .NewSimple(bindData));
 }
        /// <summary>
        /// 根据查询条件,获取交易商品品种
        /// </summary>
        /// <returns></returns>
        private bool QueryCMBreedClass()
        {
            try
            {
                int BourseTypeID     = AppGlobalVariable.INIT_INT;
                int BreedClassTypeID = AppGlobalVariable.INIT_INT;
                if (!string.IsNullOrEmpty(cmbBourseTypeIDQ.Text))
                {
                    BourseTypeID = ((UComboItem)cmbBourseTypeIDQ.SelectedItem).ValueIndex;
                }
                if (!string.IsNullOrEmpty(cmbBreedClassTypeIDQ.Text))
                {
                    BreedClassTypeID = ((UComboItem)cmbBreedClassTypeIDQ.SelectedItem).ValueIndex;
                }
                DataSet _dsCMBreedClass = CommonParameterSetCommon.GetAllCMBreedClass(BreedClassTypeID, BourseTypeID,
                                                                                      m_pageNo,
                                                                                      m_pageSize,
                                                                                      out m_rowCount);
                DataTable _dtCMBreedClass;
                if (_dsCMBreedClass == null || _dsCMBreedClass.Tables[0].Rows.Count == 0)
                {
                    _dtCMBreedClass = new DataTable();
                }
                else
                {
                    _dtCMBreedClass = _dsCMBreedClass.Tables[0];
                }

                //绑定交易商品品种的交易所类型ID对应的交易所名称
                ddlBourseTypeID.DataSource  = CommonParameterSetCommon.GetCMBreedClassBourseTypeName().Tables[0];
                ddlBourseTypeID.ValueMember =
                    CommonParameterSetCommon.GetCMBreedClassBourseTypeName().Tables[0].Columns["BourseTypeID"].
                    ToString();
                ddlBourseTypeID.DisplayMember =
                    CommonParameterSetCommon.GetCMBreedClassBourseTypeName().Tables[0].Columns["BourseTypeName"].
                    ToString();
                //绑定品种类型
                ddlBreedClassTypeID.DataSource    = BindData.GetBindListBreedClassType();
                ddlBreedClassTypeID.ValueMember   = "ValueIndex";
                ddlBreedClassTypeID.DisplayMember = "TextTitleValue";

                //资金账号类型
                ddlAccountTypeIDFund.DataSource    = ComboBoxDataSource.GetAccountTypeList(1);
                ddlAccountTypeIDFund.ValueMember   = "ValueIndex";
                ddlAccountTypeIDFund.DisplayMember = "TextTitleValue";
                //持仓账号类型
                ddlAccountTypeIDHold.DataSource    = ComboBoxDataSource.GetAccountTypeList(2);
                ddlAccountTypeIDHold.ValueMember   = "ValueIndex";
                ddlAccountTypeIDHold.DisplayMember = "TextTitleValue";


                gdBreedClassResult.DataSource = _dtCMBreedClass;
            }
            catch (Exception ex)
            {
                string      errCode   = "GL-4004";
                string      errMsg    = "数据不存在,获取交易商品品种失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                //throw exception;
                return(false);
            }
            return(true);
        }
Exemple #5
0
 /// <summary>解决非类类型</summary>
 /// <param name="type">参数类型</param>
 /// <param name="alias">别名</param>
 /// <returns></returns>
 private object ResolveNonClassAttr(BindData bindData, Type parent, string cls)
 {
     return null;
 }
Exemple #6
0
        /// <summary>
        /// 绑定一个服务
        /// </summary>
        /// <param name="service">服务名</param>
        /// <param name="concrete">服务实体</param>
        /// <param name="isStatic">服务是否静态化</param>
        /// <returns></returns>
        public IBindData Bind(string service , Func<IContainer, object[], object> concrete, bool isStatic)
        {
            service = Normalize(service);

            instances.Remove(service);
            alias = alias.RemoveValue(service);
            alias.Remove(service);

            BindData bindData = new BindData(this , service , concrete, isStatic);

            binds.Add(service, bindData);

            return bindData;
        }
Exemple #7
0
        /// <summary>解决类类型</summary>
        /// <returns></returns>
        private object ResloveClassAttr(BindData bindData , Type parent, string cls)
        {
            object obj = null;

            if (cls == typeof(Configs).ToString())
            {
                if (config == null) { this.InitConfig(); }
                if (config.ContainsKey(parent))
                {
                    obj = config[parent];
                }
            }
            else
            {
                obj = Make(bindData.GetContextual(cls));
            }

            return obj;
        }
Exemple #8
0
        /// <summary>构造服务</summary>
        /// <param name="type"></param
        /// <param name="bindData"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        private object Build(BindData bindData , string service, object[] param)
        {
            if (param == null) { param = new object[] { }; }
            Type type = Type.GetType(bindData.Service);
            if(type == null){ return null; }
            if (type.IsAbstract || type.IsInterface)
            {
                if (service != bindData.Service)
                {
                    type = Type.GetType(service);
                }
                else
                {
                    return null;
                }
            }
            ConstructorInfo[] constructor = type.GetConstructors();
            if (constructor.Length <= 0)
            {
                return Activator.CreateInstance(type);
            }

            List<ParameterInfo> parameter = new List<ParameterInfo>(constructor[constructor.Length - 1].GetParameters());
            parameter.RemoveRange(0, param.Length);

            if (parameter.Count > 0) { param = GetDependencies(bindData , type, parameter, param); }

            return Activator.CreateInstance(type, param);
        }
Exemple #9
0
        /// <summary>
        /// 常规编译
        /// </summary>
        /// <param name="bindData"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        private object NormalBuild(BindData bindData, object[] param)
        {
            if (bindData.Concrete != null)
            {
                return bindData.Concrete(this, param);
            }

            return Build(bindData , bindData.Service, param);
        }
Exemple #10
0
        /// <summary>解决类类型</summary>
        /// <param name="bindData"></param>
        /// <param name="parent"></param>
        /// <param name="info">参数信息</param>
        /// <returns></returns>
        private object ResloveClass(BindData bindData, Type parent, ParameterInfo info)
        {
            object obj = null;

            if (info.ParameterType == typeof(Configs))
            {
                if (config == null) { this.InitConfig(); }
                if (config.ContainsKey(parent))
                {
                    obj = config[parent];
                }
            }
            else
            {
                obj = this.Make(bindData.GetContextual(info.ParameterType.ToString()), null);
            }

            if (obj == null) { return info.DefaultValue; }
            return obj;
        }
Exemple #11
0
        /// <summary>获取依赖关系</summary>
        /// <param name="type">类型</param>
        /// <param name="paramInfo">参数信息</param>
        /// <param name="param">手动输入的参数</param>
        /// <returns></returns>
        private object[] GetDependencies(BindData bindData, Type type, List<ParameterInfo> paramInfo, object[] param)
        {
            List<object> myParam = new List<object>(param);

            foreach (ParameterInfo info in paramInfo)
            {
                if (info.ParameterType.IsClass || info.ParameterType.IsInterface)
                {
                    myParam.Add(ResloveClass(bindData , type, info));
                }
                else
                {
                    myParam.Add(ResolveNonClass(bindData , type , info));
                }
            }

            return myParam.ToArray();
        }
Exemple #12
0
 private object ExecDecorator(BindData bindData, object obj)
 {
     if (decorator != null)
     {
         foreach (Func<IContainer , IBindData, object, object> func in decorator)
         {
             obj = func(this , bindData, obj);
         }
     }
     return obj;
 }
Exemple #13
0
        /// <summary>属性注入</summary>
        /// <param name="cls"></param>
        private void DIAttr(BindData bindData , object cls)
        {
            if (cls == null) { return; }

            string typeName;
            foreach (PropertyInfo property in cls.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {

                if (!property.CanWrite) { continue; }
                object[] propertyAttrs = property.GetCustomAttributes(typeof(Dependency), true);
                if (propertyAttrs.Length <= 0) { continue; }

                Dependency dependency = propertyAttrs[0] as Dependency;
                if (string.IsNullOrEmpty(dependency.Alias))
                {
                    typeName = property.PropertyType.ToString();
                }else
                {
                    typeName = dependency.Alias;
                }

                if (property.PropertyType.IsClass || property.PropertyType.IsInterface)
                {
                    property.SetValue(cls, ResloveClassAttr(bindData, cls.GetType(), typeName), null);
                }
                else
                {
                    property.SetValue(cls, ResolveNonClassAttr(bindData , cls.GetType(), typeName), null);
                }
            }
        }
Exemple #14
0
        public static BindResult <T> Run <T>(this BindData <T> data, string text)
        {
            var keyInput = KeyInputUtil.CharToKeyInput(text[0]);

            return(data.BindFunction.Invoke(keyInput).Run(text.Substring(1)));
        }
Exemple #15
0
 /// <summary>解决非类类型</summary>
 /// <param name="info">参数信息</param>
 /// <returns></returns>
 private object ResolveNonClass(BindData bindData, Type parent, ParameterInfo info)
 {
     return info.DefaultValue;
 }
Exemple #16
0
        public static BindResult <T> Run <T>(this BindData <T> data, params VimKey[] keys)
        {
            var result = data.BindFunction.Invoke(KeyInputUtil.VimKeyToKeyInput(keys[0]));

            return(result.Run(keys.Skip(1).ToArray()));
        }
        public void RefreshDatas()
        {
            if (ObjectList == null)
            {
                return;
            }
            TreeViewItemsNodes.Clear();

            PropertyInfo propertytype = null;

            if (ObjectList.Count > 0)
            {
                var            obj        = ObjectList[0];
                Type           type       = obj.GetType();
                PropertyInfo[] properties = type.GetProperties();
                foreach (var ptype in properties)
                {
                    MacrossClassKeyAttribute attr = ptype.GetCustomAttribute <MacrossClassKeyAttribute>();
                    if (attr != null)
                    {
                        propertytype = ptype;
                        break;
                    }
                }

                //MacrossClassKeyAttribute attr = type.GetCustomAttribute<MacrossClassKeyAttribute>();
            }

            for (int i = 0; i < ObjectList.Count; i++)
            {
                string ObjectName = i.ToString();
                object value      = null;
                if (propertytype != null)
                {
                    value = propertytype.GetValue(ObjectList[i]);
                    if (value != null)
                    {
                        ObjectName = value.ToString();
                    }
                    else
                    {
                        propertytype.SetValue(ObjectList[i], ObjectName);
                    }
                }
                if (mLowerFilterString.Equals("") || ObjectName.ToLower().IndexOf(mLowerFilterString) != -1)
                {
                    BindData bd = new BindData();
                    bd.ObjectIndex = i.ToString();
                    if (propertytype != null)
                    {
                        BindingOperations.SetBinding(bd, BindData.ObjectNameProperty, new Binding(propertytype.Name)
                        {
                            Source = ObjectList[i]
                        });
                    }
                    else
                    {
                        bd.ObjectName = ObjectName;
                    }

                    bd.Value = ObjectList[i];
                    TreeViewItemsNodes.Add(bd);
                }
            }
        }