Example #1
0
        private void 多语言配置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SDPCRL.COM.ModelManager.LibDataSource            ds = null;
            SDPCRL.COM.ModelManager.FormTemplate.LibFormPage fm = null;
            SDPCRL.COM.ModelManager.LibKeyValueCollection    keyvaluecollection = null;
            TabPage page = this.libTabControl1.SelectedTab;

            if (page != null)
            {
                string[] nameAndtype = page.Name.Split(SysConstManage.Underline);
                NodeType ntype       = LibSysUtils.ConvertToEnumType <NodeType>(nameAndtype[1]);
                switch (ntype)
                {
                case NodeType.DataModel:
                    ds = ModelDesignProject.GetDataSourceById(nameAndtype[0]);
                    break;

                case NodeType.FormModel:
                    fm = ModelDesignProject.GetFormSourceByFormId(nameAndtype[0]);
                    if (fm != null && !string.IsNullOrEmpty(fm.DSID))
                    {
                        ds = ModelDesignProject.GetDataSourceById(fm.DSID);
                    }
                    break;

                case NodeType.KeyValues:
                    keyvaluecollection = ModelDesignProject.GetKeyvaluesByid(nameAndtype[0]);
                    break;
                }
            }
            WakeUpForm <LanguageConfig>("language", ds, fm, keyvaluecollection);
        }
Example #2
0
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            LibTreeNode curentNode = (LibTreeNode)this.treeView1.SelectedNode;

            switch (e.ClickedItem.Name)
            {
            case "andTransField":     //添加转单字段
                if (this._Trans.TransFields == null)
                {
                    _Trans.TransFields = new LibCollection <LibTransFieldMap>();
                }
                var existfields = _Trans.TransFields.Tolist();
                if (string.IsNullOrEmpty(_Trans.SrcProgId))
                {
                    ExceptionManager.ThrowError("来源单progid 必填");
                    //MessageHandle.ShowMessage("来源单progid 必填",false);
                }
                var           formpage = ModelDesignProject.GetFormSourceByFormId(_Trans.SrcProgId);
                LibDataSource ds       = ModelDesignProject.GetDataSourceById(formpage.DSID);
                Panel         p        = new Panel();
                p.Dock       = DockStyle.Fill;
                p.Name       = "pfieldcollection";
                p.AutoScroll = true;
                TreeView tree = new TreeView();
                //tree.AfterCheck += new TreeViewEventHandler(Gridtree_AfterCheck);
                tree.CheckBoxes = true;
                tree.Dock       = DockStyle.Fill;
                p.Controls.Add(tree);
                LibTreeNode _node;
                if (ds.DefTables != null)
                {
                    List <ExistField> exists = new List <ExistField>();
                    foreach (var item in existfields)
                    {
                        exists.Add(new ExistField {
                            Name = item.SrcFieldNm, FromTableNm = item.SrcTableNm
                        });
                    }
                    DSUtiles.GetAllFieldsByDS(ds, tree, exists);
                }
                FieldCollectionForm fielsform = new FieldCollectionForm(p);
                DialogResult        dialog    = fielsform.ShowDialog(this);
                if (dialog == DialogResult.OK)
                {
                    curentNode.Nodes.Clear();
                    if (_Trans.TransFields != null && _Trans.TransFields.Count > 0)
                    {
                        _Trans.TransFields.RemoveAll();
                    }
                    foreach (LibTreeNode deftb in tree.Nodes)
                    {
                        foreach (LibTreeNode tbstruct in deftb.Nodes)
                        {
                            foreach (LibTreeNode f in tbstruct.Nodes)
                            {
                                if (!f.Checked)
                                {
                                    continue;
                                }
                                #region 添加节点
                                //树节点

                                LibTreeNode fieldNode = new LibTreeNode();
                                fieldNode.NodeId   = Guid.NewGuid().ToString();
                                fieldNode.NodeType = NodeType.TransField;
                                fieldNode.Name     = f.Name;
                                fieldNode.Text     = fieldNode.Name;
                                curentNode.Nodes.Add(fieldNode);

                                //控件属性
                                TransFieldProperty fieldProperty = new TransFieldProperty(fieldNode.NodeId);
                                _transFieldlst.Add(fieldProperty);
                                fieldProperty.Dock = DockStyle.Fill;
                                this.splitContainer1.Panel2.Controls.Add(fieldProperty);

                                //对应实体
                                LibTransFieldMap libtransfield = new LibTransFieldMap();
                                libtransfield.ID         = fieldNode.NodeId;
                                libtransfield.SrcFieldNm = f.Name;
                                libtransfield.SrcTableNm = (bool)f.Tag ? tbstruct.Name : string.Empty;
                                //libtransfield.FromDefTableNm = (bool)f.Tag ? deftb.Name : string.Empty;
                                libtransfield.SrcTableIndex   = Convert.ToInt32(tbstruct.NodeId);
                                libtransfield.SrcFieldDisplay = f.Text;
                                //libtransfield.Isdefine = !(bool)f.Tag;

                                _Trans.TransFields.Add(libtransfield);

                                fieldProperty.SetPropertyValue(libtransfield, fieldNode);

                                #endregion
                            }
                        }
                    }
                    UpdateTabPageText();
                }
                break;
            }
        }
Example #3
0
        public override void TextAndBotton_Click(object sender, EventArgs e)
        {
            base.TextAndBotton_Click(sender, e);
            Control ctl   = sender as Control;
            string  ctrNm = ctl.Name.Replace(SysConstManage.BtnCtrlNmPrefix, "");

            if (_Node != null)
            {
                var            pnode       = _Node.Parent as TreeNode;
                LibTransSource transSource = pnode.Tag as LibTransSource;
                if (string.Compare(ctrNm, "tranfld_TargetFieldNm") == 0)
                {
                    if (string.IsNullOrEmpty(transSource.TargetProgId))
                    {
                        ExceptionManager.ThrowError("目标单progid 必填");
                        //MessageHandle.ShowMessage("来源单progid 必填",false);
                    }
                    var           formpage = ModelDesignProject.GetFormSourceByFormId(transSource.TargetProgId);
                    LibDataSource ds       = ModelDesignProject.GetDataSourceById(formpage.DSID);
                    Panel         p        = new Panel();
                    p.Dock       = DockStyle.Fill;
                    p.Name       = "pfieldcollection";
                    p.AutoScroll = true;
                    TreeView tree = new TreeView();
                    tree.AfterCheck += new TreeViewEventHandler(tree_AfterCheck);
                    tree.CheckBoxes  = true;
                    tree.Dock        = DockStyle.Fill;
                    p.Controls.Add(tree);
                    //LibTreeNode _node;
                    if (ds.DefTables != null)
                    {
                        List <ExistField> exists = new List <ExistField>();
                        exists.Add(new ExistField {
                            Name = this.entity.TargetFieldNm, FromTableNm = this.entity.TargetTableNm
                        });
                        DSUtiles.GetAllFieldsByDS(ds, tree, exists);
                    }

                    FieldCollectionForm fielsform = new FieldCollectionForm(p);
                    DialogResult        dialog    = fielsform.ShowDialog(this);
                    if (dialog == DialogResult.OK)
                    {
                        foreach (LibTreeNode deftb in tree.Nodes)
                        {
                            foreach (LibTreeNode tbstruct in deftb.Nodes)
                            {
                                foreach (LibTreeNode f in tbstruct.Nodes)
                                {
                                    if (!f.Checked)
                                    {
                                        continue;
                                    }
                                    this.entity.TargetFieldNm      = f.Name;
                                    this.entity.TargetFieldDisplay = f.Text;
                                    this.entity.TargetTableNm      = (bool)f.Tag ? tbstruct.Name : string.Empty;
                                    this.entity.TargetTableIndex   = Convert.ToInt32(tbstruct.NodeId);
                                    break;
                                }
                            }
                        }
                        this.SetPropertyValue(this.entity, _Node);
                        UpdateTabPageText();
                    }
                }
            }
        }