예제 #1
0
 public NewBillerHeadItem(IBiller biller, IHead parent, int index)
 {
     this.Biller         = biller;
     this.Parent         = parent;
     this.Index          = index;
     this.m_BillTransfer = this.Biller.M_BillTransfer as K3ClassEvents.BillEvent;
 }
예제 #2
0
        private void ExtendStringToMatchByOneCharacter(char c)
        {
            List <IHead> newHeads = _listForLocalUseage;

            newHeads.Clear();
            List <IHead> lastAddedHeads = null;

            for (int i = 0; i < _heads.Count; i++)
            {
                IHead         head       = _heads[i];
                IList <IHead> headsToAdd = head.GetNextHeads(c);

                // Why the next performance optimization isn't wrong:
                // Some times two heads return the very same list.
                // We save future effort if we don't add these heads again.
                // This is the case with the heads "a" and "*" of "a*b" which
                // both can return the list ["*","b"]
                if (headsToAdd != lastAddedHeads)
                {
                    newHeads.AddRange(headsToAdd);
                    lastAddedHeads = new List <IHead>(headsToAdd);
                }
            }

            _listForLocalUseage = _heads;
            _heads = newHeads;
        }
예제 #3
0
 public OldBillHeadItem(IBiller biller, IHead parent, int index)
 {
     this.Biller         = biller;
     this.m_BillTransfer = this.Biller.M_BillTransfer as k3BillTransfer.Bill;
     this.Parent         = parent;
     this.Index          = index;
 }
예제 #4
0
 /// <summary>
 /// Tworzy obiekt z referencja do glowicy
 /// </summary>
 /// <param name="head">Glowica</param>
 /// <exception cref="ArgumentNullException">W momencie gdy glowica jest null</exception>
 public Pump(IHead head)
 {
     if (head == null)
     {
         throw new ArgumentNullException("Glowica jest nullem");
     }
     this.head = head;
 }
    private void Start() //main
    {
        // IFactory_Insect factory = new Factory_EastInsect();
        IFactory_Insect factory = new Factory_WestInsect();

        IHead  head  = factory.Create_Head();
        IChest chest = factory.Create_Chest();

        head.See();
    }
예제 #6
0
        public Form1()
        {
            InitializeComponent();
            WindowArea.WinSize = pictureBox1.Size;
            App  = new MainApp();
            Draw = new Draw(pictureBox1);
            Head = ElementManager.Instance.Head;

            BringToFront();
            Focus();
            KeyPreview = true;
            KeyDown   += new KeyEventHandler(Form1_KeyDown);
        }
예제 #7
0
 public void SetHead(IHead head)
 {
     Head = head;
 }
예제 #8
0
 public Race(IRacePartFactory racePartFactory)
 {
     Head    = racePartFactory.CreateHead();
     Skin    = racePartFactory.CreateSkin();
     Stature = racePartFactory.CreateStature();
 }
예제 #9
0
 public ApplePhone(IHead head)
 {
     this.head = head;
     Console.WriteLine("ApplePhone(IHead head)");
 }
예제 #10
0
        /// <summary>
        /// 模型绑定到单据头
        /// </summary>
        /// <param name="head"></param>
        /// <param name="model"></param>
        public void SetModelToHead(IHead head, object model)
        {
            Type type = model.GetType(); //获取类型
            var  propertyInfoArray = type.GetProperties();

            foreach (var p in propertyInfoArray)
            {
                var cuestAttr = p.GetCustomAttributes(typeof(K3FieldAttribute), false);
                K3FieldAttribute k3Field;
                string           fieldName;
                var value = p.GetValue(model, null);//当前Model字段值

                //不参与转换
                if (cuestAttr.Length > 0 && (cuestAttr[0] as K3FieldAttribute).K3FieldType.Contains(K3FieldTypeEnum.Nothing))
                {
                    continue;
                }

                if (cuestAttr.Length == 0)
                {
                    //如果什么都不填,使用默认转换
                    k3Field = new K3FieldAttribute();
                }
                else
                {
                    k3Field = cuestAttr[0] as K3FieldAttribute;
                }

                value = k3Field.k3FieldSetValueFunc.ModelToUiValue(value);

                fieldName = k3Field.Name;
                //如果没有设置模型对应的UI字段名称,则UI字段名称与Model名称一致
                if (string.IsNullOrEmpty(fieldName))
                {
                    fieldName = p.Name;
                }

                //双向绑定
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.All))
                {                    //如果为空则给空值
                    if (value == null || string.IsNullOrEmpty(value.ToString()))
                    {
                        head[fieldName].Value = "";
                        continue;
                    }
                    head[fieldName].Value = value.ToString();
                }

                //模型的基础资料值为Name
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_ModelNameToUi))
                {
                    //如果为空则给空值
                    if (value == null || string.IsNullOrEmpty(value.ToString()))
                    {
                        head[fieldName].Value = "";
                        continue;
                    }
                    head[fieldName].Value = this.baseDataDao.GetListByName(k3Field.ItemType, value.ToString())[0].FName;
                }

                //模型的基础资料值为Number
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_ModelNumberToUi))
                {
                    head[fieldName].Value = value.ToString();
                }
            }
        }
예제 #11
0
        /// <summary>
        /// 单据头绑定到模型
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="head"></param>
        /// <returns></returns>
        public T SetHeadToModel <T>(IHead head) where T : class
        {
            Type type              = typeof(T); //获取类型
            var  result            = type.Assembly.CreateInstance(type.FullName) as T;
            var  propertyInfoArray = type.GetProperties();

            //遍历所有属性
            foreach (var p in propertyInfoArray)
            {
                var cuestAttr = p.GetCustomAttributes(typeof(K3FieldAttribute), false);
                K3FieldAttribute k3Field;
                string           fieldName;

                //不参与转换
                if (cuestAttr.Length > 0 && (cuestAttr[0] as K3FieldAttribute).K3FieldType.Contains(K3FieldTypeEnum.Nothing))
                {
                    continue;
                }

                if (cuestAttr.Length == 0)
                {
                    //如果什么都不填,使用默认转换
                    k3Field = new K3FieldAttribute();
                }
                else
                {
                    k3Field = cuestAttr[0] as K3FieldAttribute;
                }

                fieldName = k3Field.Name;
                //如果没有设置模型对应的UI字段名称,则UI字段名称与Model名称一致
                if (string.IsNullOrEmpty(fieldName))
                {
                    fieldName = p.Name;
                }

                //双向绑定
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.All))
                {
                    p.SetValue(result, k3Field.k3FieldSetValueFunc.UiToModelValue(head[fieldName].Value), null);
                }

                //绑定Ui基资料的Value到Model
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_UiValueToModel))
                {
                    p.SetValue(result, k3Field.k3FieldSetValueFunc.UiToModelValue(head[fieldName].Value), null);
                }

                //绑定Ui基资料的Number到Model
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_UiNumberToModel))
                {
                    p.SetValue(result, k3Field.k3FieldSetValueFunc.UiToModelValue(head[fieldName].Number), null);
                }

                //绑定Ui基资料的Name到Model
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_UiNameToModel))
                {
                    p.SetValue(result, k3Field.k3FieldSetValueFunc.UiToModelValue(head[fieldName].Name), null);
                }
            }
            return(result);
        }
예제 #12
0
 public void SetHead(IHead head)
 {
     this.head = head;
 }
예제 #13
0
 public Race(IRacePartsFactory raceFactory)
 {
     this.Head    = raceFactory.CreateHead();
     this.Stature = raceFactory.CreateStature();
     this.Skin    = raceFactory.CreateSkin();
 }
예제 #14
0
 public IosPhone(IHead head)
 {
     this.Head = head;
     Console.WriteLine();
 }