public override void BeforeInit()
 {
     //得到模板数据
     tmpXls            = tmpXlsManager.FindThe(4887101819480924880);
     tmpXlsItem        = tmpXlsManager.FindThe(5126702061095765704);
     this.GridStartRow = 7;
 }
 public override void BeforeInit()
 {
     //得到模板数据
     tmpXls     = tmpXlsManager.FindThe(4737506234498655130);
     tmpXlsItem = tmpXlsManager.FindThe(5557049638610432885);
     this.GridColSpaceLastCount = 1;
     this.GridRowSpaceLastCount = 1;
 }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            if (!this.blNewFlag)
            {
                Model.Info_tmp_xls info = modelObj as Model.Info_tmp_xls;
                SetInfo(info);
            }
        }
示例#4
0
        private void BtnBind_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_tmp_xls info            = mDataGridNvl.GetCurrentEntity() as Model.Info_tmp_xls;
            FmMapXlsManager    fmMapXlsManager = new FmMapXlsManager();

            fmMapXlsManager.Tag = info;
            fmMapXlsManager.ShowDialog();
        }
示例#5
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();
        }
示例#6
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_tmp_xls info = mDataGridNvl.GetCurrentEntity() as Model.Info_tmp_xls;

            FmTmpXlsInfo fmTmpXlsInfo = new FmTmpXlsInfo(info);

            fmTmpXlsInfo.SelectValue += (obj) =>
            {
                LoadAllTmp();
            };
            fmTmpXlsInfo.ShowDialog();
        }
示例#7
0
        private void LoadAllParmMap()
        {
            Model.Info_tmp_xls tmpXls = this.Tag as Model.Info_tmp_xls;
            long tmpId = tmpXls.Tmp_Id;
            List <Model.Tb_tmp_xls_map> list = Miles.Coro.ORM.Repository.SingleRepository
                                               .Query()
                                               .From <Model.Tb_tmp_xls_map>()
                                               .ToSelect().EndSelect()
                                               .ToWhere()
                                               .And(Model.Tb_tmp_xls_map.Table.Tmp_Id, tmpId)
                                               .EndWhere()
                                               .ToQuery()
                                               .ToList <Model.Tb_tmp_xls_map>();

            mDataGrid1.SetDataSource <Model.Tb_tmp_xls_map>(list);
        }
示例#8
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_tmp_xls info = mDataGridNvl.GetCurrentEntity() as Model.Info_tmp_xls;

            string msg = string.Format("确定删除:{0}信息?", info.Tmp_Name);

            if (Miles.Framework.UI.Function.Dialog.ShowQuestionYesNo(msg))
            {
                if (manager.Remove(info))
                {
                    LoadAllTmp();
                }
            }
        }
示例#9
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();
        }
示例#10
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_tmp_xls info = mDataGridNvl.GetCurrentEntity() as Model.Info_tmp_xls;

            using (MemoryStream stream = new MemoryStream())
            {
                reoGridControl1.Save(stream, unvell.ReoGrid.IO.FileFormat.Excel2007);
                info.Tmp_Body = stream.ToArray();
            }


            List <Model.Tb_tmp_xls_var> vars = new List <Model.Tb_tmp_xls_var>();

            int rowCount = (int)info.Row_Count;
            int colCount = (int)info.Column_Count;
            List <unvell.ReoGrid.Cell> cellsTmp = Miles.ReoGrid.ReportTemplateBind.GetRangeMergedCells(this.reoGridControl1.CurrentWorksheet, 0, 0, rowCount, colCount);

            foreach (unvell.ReoGrid.Cell cell in cellsTmp)
            {
                string str = GaoShan.Sales.UI.Report.ReportTemplateBase.FindVarString(cell.DisplayText);
                if (str != null)
                {
                    Model.Tb_tmp_xls_var v = new Model.Tb_tmp_xls_var();
                    //v.Var_Id= Miles.Coro.Common.Utils.GuidToInt64();
                    v.Tmp_Id   = info.Tmp_Id;
                    v.Var_Text = str;
                    vars.Add(v);
                }
            }

            info.Vars = vars;

            if (manager.SaveBodyAndVars(info))
            {
                LoadAllTmp();
                Miles.Framework.UI.Function.MForm.SetToolStripButtonTip(this.btnSave, "保存成功");
            }
        }
示例#11
0
        protected void InsertItems(IList items, Model.Info_tmp_xls tmpXlsItem)
        {
            Miles.ReoGrid.ReportTemplate reportTemplate = new Miles.ReoGrid.ReportTemplate();
            reportTemplate.TemplateStream  = new MemoryStream(tmpXlsItem.Tmp_Body);
            reportTemplate.InitColumnCount = (int)tmpXlsItem.Column_Count;
            reportTemplate.InitRowCount    = (int)tmpXlsItem.Row_Count;
            reportTemplate.Bind(null, null);

            int itemStartRow    = (int)tmpXls.Item_Start_Row;
            int itemStartColumn = (int)tmpXls.Item_Start_Column;
            int itemGroupCount  = (int)tmpXls.Item_Row_Count;

            Dictionary <string, Model.Tb_tmp_xls_map> dicMap = new Dictionary <string, Model.Tb_tmp_xls_map>();

            foreach (var v in tmpXlsItem.VarMaps)
            {
                dicMap.Add(v.Var_Text, v);
            }
            InsertItems(items, new XlsItemGroup(reportTemplate.GetAllMergedCells(), itemGroupCount, dicMap), itemStartRow, itemStartColumn);
        }
示例#12
0
        private void BtnImport_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_tmp_xls info = mDataGridNvl.GetCurrentEntity() as Model.Info_tmp_xls;

            OpenFileDialog dialog = new OpenFileDialog();

            //dialog.Multiselect = true;//该值确定是否可以选择多个文件
            dialog.Title  = "请选择文件";
            dialog.Filter = @"模板文件|*.xlsx";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.reoGridControl1.Reset();
                reoGridControl1.Load(dialog.FileName, unvell.ReoGrid.IO.FileFormat.Excel2007);
                reoGridControl1.CurrentWorksheet.RowCount    = (int)info.Row_Count;
                reoGridControl1.CurrentWorksheet.ColumnCount = (int)info.Column_Count;
            }
        }
示例#13
0
        private void MDataGridNvl_CurrentRowChanged(object sender, EventArgs e)
        {
            reoGridControl1.Reset();

            Model.Info_tmp_xls info = mDataGridNvl.GetCurrentEntity() as Model.Info_tmp_xls;
            if (info == null)
            {
                return;
            }

            //if (info.Tmp_Body == null)
            //{
            //    info.Tmp_Body = manager.GetTheTmpBody(info.Tmp_Id);
            //}

            if (info.Tmp_Body != null)
            {
                reoGridControl1.Load(new MemoryStream(info.Tmp_Body), unvell.ReoGrid.IO.FileFormat.Excel2007);
                reoGridControl1.CurrentWorksheet.RowCount    = (int)info.Row_Count;
                reoGridControl1.CurrentWorksheet.ColumnCount = (int)info.Column_Count;
            }
        }
示例#14
0
        protected override bool BtnOkClick()
        {
            if (string.IsNullOrEmpty(this.d_Name.Text))
            {
                Miles.Framework.UI.Function.MForm.SetToolTip(this.d_Name, "名称不能为空", 1000);
                return(false);
            }

            Model.Info_tmp_xls old  = modelObj as Model.Info_tmp_xls;
            Model.Info_tmp_xls info = old != null?this.GetDataBind <Model.Info_tmp_xls>(old) : this.GetDataBind <Model.Info_tmp_xls>();


            if (this.blNewFlag)
            {
                //info.Part_Id = Miles.Coro.Common.Utils.GuidToInt64();
                if (!manager.Add(info))
                {
                    return(false);
                }
            }
            else
            {
                //Model.Info_tmp_xls updateInfo = modelObj as Model.Info_tmp_xls;
                //updateInfo.Tmp_Name = info.Tmp_Name;
                //updateInfo.Tmp_Explain = info.Tmp_Explain;

                if (!manager.UpdateInfo(info))
                {
                    return(false);
                }
            }

            this.DoSelectValueEvent(info);

            return(true);
        }
示例#15
0
 private void SetInfo(Model.Info_tmp_xls info)
 {
     this.SetDataBind(info);
 }
示例#16
0
 public FmTmpXlsInfo(Model.Info_tmp_xls info)
     : base(info)
 {
     InitializeComponent();
 }
 public override void BeforeInit()
 {
     //得到模板数据
     tmpXls     = tmpXlsManager.FindThe(4712284195760822845);
     tmpXlsItem = tmpXlsManager.FindThe(5179524403633683467);
 }