Beispiel #1
0
        protected override bool BtnOkClick()
        {
            Model.Tb_tmp_xls_map old = this.modelObj as Model.Tb_tmp_xls_map;

            Model.Tb_tmp_xls_map info = this.GetDataBind <Model.Tb_tmp_xls_map>(old);
            //old.Var_Explain = info.Var_Explain;
            //old.Field_Name = info.Field_Name;
            //old.Field_Format = info.Field_Format;


            if (Miles.Coro.ORM.Repository.SingleRepository.Update <Model.Tb_tmp_xls_map>()
                .Set()
                .AllFields(info)
                .EndSet()
                .Where()
                .And(Model.Tb_tmp_xls_map.Table.Tmp_Id, old.Tmp_Id)
                .And(Model.Tb_tmp_xls_map.Table.Var_Text, old.Var_Text)
                .EndWhere()
                .Save() < 1)
            {
                return(false);
            }

            this.DoSelectValueEvent(old);

            return(true);
        }
Beispiel #2
0
        protected void ReplaceVar(object dataSource, bool isClearEmptyVar = true)
        {
            List <unvell.ReoGrid.Cell> cells = this.GetAllMergedCells();

            foreach (unvell.ReoGrid.Cell cellFrom in cells)
            {
                string varText = FindVarString(cellFrom.DisplayText);
                if (varText != null)
                {
                    Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance;

                    Model.Tb_tmp_xls_map map = dicVarMap.ContainsKey(varText) ? dicVarMap[varText] : null;
                    if (map != null)
                    {
                        string dataField         = map.Field_Name;
                        object value             = memberAccessor.GetValue(dataSource, dataField);
                        unvell.ReoGrid.Cell cell = this.Sheet.Cells[cellFrom.Row, cellFrom.Column];
                        if (value != null)
                        {
                            SetCellFormatData(cell, value, map.Field_Format);
                        }
                        else
                        {
                            if (isClearEmptyVar)
                            {
                                SetCellFormatData(cell, "", null);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public FmMapXlsInfo(Model.Tb_tmp_xls_map info, string typeFullName)
            : base(info)
        {
            InitializeComponent();

            if (typeFullName != null)
            {
                d_field_Name.LoadData(typeFullName);
            }
        }
Beispiel #4
0
        void mDataGrid1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (this.mDataGrid1.CurrentRow == null)
            {
                return;
            }

            Model.Info_tmp_xls tmpXls = this.Tag as Model.Info_tmp_xls;

            Model.Tb_tmp_xls_map info = mDataGrid1.GetCurrentEntity() as Model.Tb_tmp_xls_map;
            FmMapXlsInfo         fm   = new FmMapXlsInfo(info, tmpXls.Source_Type);

            fm.SelectValue += new SelectValueHandler(fm_SelectValue);
            fm.ShowDialog();
        }
Beispiel #5
0
        protected void InsertItems(IList items, XlsItemGroup xlsItemGroup, int itemStartRow, int itemStartCol)
        {
            int itemCount = items.Count;
            int rowCount  = xlsItemGroup.RowCount;

            if (itemCount > 1)
            {
                this.Sheet.InsertRows(itemStartRow + rowCount, rowCount * (itemCount - 1));
            }

            //按照插入行行的合并情况,循环列合并,新增加的行的列
            for (int row = 1; row < itemCount; row++)
            {
                SetItemGroupMergedCell(this.Sheet, itemStartRow + row * rowCount, itemStartCol, xlsItemGroup.CellsTmp);
            }

            for (int row = 0; row < itemCount; row++)
            {
                object dataSource = items[row];
                foreach (unvell.ReoGrid.Cell cellFrom in xlsItemGroup.CellsTmp)
                {
                    int realRow = itemStartRow + row * rowCount;
                    unvell.ReoGrid.Cell cell = this.Sheet.Cells[cellFrom.Row + realRow, cellFrom.Column + itemStartCol];
                    string varText           = FindVarString(cellFrom.DisplayText);
                    if (varText != null)
                    {
                        Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor memberAccessor = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance;

                        Model.Tb_tmp_xls_map map = xlsItemGroup.DicVarMap.ContainsKey(varText) ? xlsItemGroup.DicVarMap[varText] : null;
                        if (map != null)
                        {
                            string dataField = map.Field_Name;
                            object value     = memberAccessor.GetValue(dataSource, dataField);
                            if (value != null)
                            {
                                //根据格式来设置单元格值
                                SetCellFormatData(cell, value, map.Field_Format);
                                this.Sheet.AutoFitRowHeight(realRow);
                            }
                        }
                    }
                    else
                    {
                        cell.Data = cellFrom.Data;
                    }
                }
            }
        }
Beispiel #6
0
        void btnSyn_Click(object sender, EventArgs e)
        {
            Model.Info_tmp_xls tmpXls = this.Tag as Model.Info_tmp_xls;
            long tmpId = tmpXls.Tmp_Id;

            Miles.Coro.ORM.Repository   repository = Miles.Coro.ORM.Repository.SingleRepository;
            List <Model.Tb_tmp_xls_var> vars       = repository
                                                     .Query()
                                                     .From <Model.Tb_tmp_xls_var>()
                                                     .ToSelect().EndSelect()
                                                     .ToWhere()
                                                     .And(Model.Tb_tmp_xls_var.Table.Tmp_Id, tmpId)
                                                     .EndWhere()
                                                     .ToQuery()
                                                     .ToList <Model.Tb_tmp_xls_var>();


            List <Model.Tb_tmp_xls_map> mapList = mDataGrid1.GetDataSource <Model.Tb_tmp_xls_map>();

            var mapVars = from v in mapList select v.Var_Text;

            var quary = from item in vars
                        where !mapVars.Contains(item.Var_Text)
                        select item;

            repository.DbManager.BeginTransaction();

            foreach (var v in quary)
            {
                Model.Tb_tmp_xls_map map = new Model.Tb_tmp_xls_map();
                map.Tmp_Id   = tmpId;
                map.Var_Text = v.Var_Text;
                if (!repository.Add(map))
                {
                    repository.DbManager.RollBack();
                    return;
                }
            }

            repository.DbManager.Commit();
            LoadAllParmMap();
        }
Beispiel #7
0
        void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.mDataGrid1.CurrentRow == null)
            {
                return;
            }

            Model.Tb_tmp_xls_map info = mDataGrid1.GetCurrentEntity() as Model.Tb_tmp_xls_map;
            string msg = string.Format("确定删除:{0}信息?", info.Var_Text);

            if (Miles.Framework.UI.Function.Dialog.ShowQuestionYesNo(msg))
            {
                if (Miles.Coro.ORM.Repository.SingleRepository.Remove <Model.Tb_tmp_xls_map>()
                    .Where()
                    .And(Model.Tb_tmp_xls_map.Table.Tmp_Id, info.Tmp_Id)
                    .And(Model.Tb_tmp_xls_map.Table.Var_Text, info.Var_Text)
                    .EndWhere()
                    .Save() > 0)
                {
                    LoadAllParmMap();
                }
            }
        }
Beispiel #8
0
 void fm_SelectValue(object obj)
 {
     Model.Tb_tmp_xls_map info = obj as Model.Tb_tmp_xls_map;
     mDataGrid1.EditCurrentItem <Model.Tb_tmp_xls_map>(info);
 }