Example #1
0
        void showRow(ImagesRow row, int top, int left, int width, double vgap, ImageAction action, ref int i)
        {
            int    rowWidth  = row.Width;
            int    rowHeight = row.Height;
            double gap       = ((double)(width - rowWidth) / (double)row.Count);

            for (int cell = 0; cell < row.Count; ++cell)
            {
                if (mPictures.Count <= i)
                {
                    AddPictureBox();
                }

                IRowItem item = row[cell];
                if (item.GetItemType() == RowType.Image)
                {
                    StackableImage image = item as StackableImage;
                    mPictures[i].mPictureBox.Left   = left;
                    mPictures[i].mPictureBox.Top    = top;
                    mPictures[i].mPictureBox.Height = (int)Math.Round(rowHeight + vgap);
                    mPictures[i].mPictureBox.Width  = (int)Math.Round(image.Width + gap);
                    left = mPictures[i].mPictureBox.Left + mPictures[i].mPictureBox.Width;

                    showNextImage(mPictures[i], action, image);
                    mPictures[i].mPictureBox.Show();
                    ++i;
                }
                else if (item.GetItemType() == RowType.Rows)
                {
                    showRows(item as ImagesRows, top, left, row.Height, (int)(item.Width + gap), action, ref i);
                    left += (int)(item.Width + gap);
                }
            }
        }
 public NewBillerCell(IBiller biller, IRowItem parent, int rowIndex, int cellIndex)
 {
     this.Biller         = biller;
     this.Parent         = parent;
     this.RowIndex       = rowIndex;
     this.CellIndex      = cellIndex;
     this.m_BillTransfer = this.Biller.M_BillTransfer as K3ClassEvents.BillEvent;
 }
 public OldBillerCell(IBiller biller, IRowItem parent, int rowIndex, int cellIndex)
 {
     this.Biller         = biller;
     this.RowIndex       = rowIndex;
     this.CellIndex      = cellIndex;
     this.m_BillTransfer = this.Biller.M_BillTransfer as k3BillTransfer.Bill;
     this.Parent         = parent;
 }
Example #4
0
        void showRows(ImagesRows rows, int top, int left, int height, int width, ImageAction action, ref int i)
        {
            if (rows.RowCount == 0)
            {
                return;
            }
            double vgap = ((double)(height - rows.Height) / (double)rows.RowCount);

            for (int row = 0; row < rows.RowCount; ++row)
            {
                IRowItem item = rows[row];
                showRow(item as ImagesRow, top, left, width, vgap, action, ref i);
                top += (int)Math.Round(item.Height + vgap);
            }
        }
Example #5
0
 /// <summary>
 /// 单据体行对像
 /// </summary>
 /// <value></value>
 /// <returns></returns>
 public IRowItem this[int index]
 {
     get
     {
         if (index < 0 || this.Count <= index)
         {
             throw new IndexOutOfRangeException("下标越界");
         }
         IRowItem rowItemInstance = null;
         if (!this._rowItemCatch.ContainsKey(index))
         {
             rowItemInstance = new NewBillerRowItem(this.Biller, this, index);
             this._rowItemCatch.Add(index, rowItemInstance);
         }
         else
         {
             rowItemInstance = this._rowItemCatch[index];
         }
         return(rowItemInstance);
     }
 }
Example #6
0
 public void Insert(IRowItem item, int position)
 {
     mImages.Insert(position, item);
 }
Example #7
0
 public void Remove(IRowItem item)
 {
     mImages.Remove(item);
 }
Example #8
0
 public void Add(IRowItem image)
 {
     mImages.Add(image);
 }
Example #9
0
        private T SetEntityRowToModel <T>(IRowItem rowItem) 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(rowItem[fieldName].Value), null);
                }

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

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

                //绑定Ui基资料的Name到Model
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_UiNameToModel))
                {
                    p.SetValue(result, k3Field.k3FieldSetValueFunc.UiToModelValue(rowItem[fieldName].Name), null);
                }
            }
            return(result);
        }
Example #10
0
        /// <summary>
        /// 模型绑定到数据行
        /// </summary>
        /// <param name="row"></param>
        /// <param name="model"></param>
        private void SetModelToEntityRow(IRowItem row, 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)
                {
                    //如果什么都不填,使用默认转换
                    k3Field = new K3FieldAttribute();
                }
                else
                {
                    k3Field = cuestAttr[0] as K3FieldAttribute;
                }

                //不参与转换
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Nothing))
                {
                    continue;
                }

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

                //双向绑定,如果不设置K3FieldType也表示为默认双向绑定
                if (k3Field.K3FieldType.Length == 0 || k3Field.K3FieldType.Contains(K3FieldTypeEnum.All))
                {                    //如果为空则给空值
                    if (value == null || string.IsNullOrEmpty(value.ToString()))
                    {
                        row[fieldName].Value = "";
                        continue;
                    }
                    row[fieldName].Value = k3Field.k3FieldSetValueFunc.ModelToUiValue(value).ToString();
                }

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

                //模型的基础资料值为Number
                if (k3Field.K3FieldType.Contains(K3FieldTypeEnum.Db_ModelNumberToUi))
                {
                    row[fieldName].Value = k3Field.k3FieldSetValueFunc.ModelToUiValue(value).ToString();
                }
            }
        }
Example #11
0
 public void Remove(IRowItem item)
 {
     mRows.Remove(item);
 }
Example #12
0
 public void Add(IRowItem row)
 {
     mRows.Add(row);
 }