コード例 #1
0
ファイル: Add.cs プロジェクト: tancfeng/YZ_WinForm
        public Add()
        {
            InitializeComponent();
            id = SRLibFun.StringConvertToInt32(Param.DPageParameter);

            List<SR_WordbookEntity> allPurviewEntList = DataBase.Instance.tSR_Wordbook.Get_EntityCollection(null, " Dtype=[$Dtype$] ", new DataParameter("Dtype", "用户权限"));
            //List<SR_WordbookEntity> myEntList = DataBase.Instance.tSR_Wordbook.Get_EntityCollection(null, " Ordernumber=[$Ordernumber$] and Dtype=[$Dtype$] ", new DataParameter("Ordernumber", id), new DataParameter("Dtype", "my用户权限"));
            if (allPurviewEntList == null) allPurviewEntList = new List<SR_WordbookEntity>();
            //if (myEntList == null) myEntList = new List<SR_WordbookEntity>();
            //List<SR_WordbookEntity> treeviewEntList = new List<SR_WordbookEntity>();

            this.BindData();
        }
コード例 #2
0
ファイル: List.cs プロジェクト: tancfeng/YZ_WinForm
        private void BindData()
        {
            //this.dataGridView1.DataSource = DataBase.Instance.tSR_User.Get_EntityCollection();

            //if (this.SelectedRowIndex < this.dataGridView1.Rows.Count)
            //    ;
            //else this.SelectedRowIndex = 0;
            //this.dataGridView1.CurrentCell = this.dataGridView1.Rows[this.SelectedRowIndex].Cells[1];
            this.panel3.Controls.Clear();
            List<SR_WordbookEntity> groupentList = DataBase.Instance.tSR_Wordbook.Get_EntityCollection(null, " Dtype='用户组' ");
            if(groupentList == null) groupentList = new List<SR_WordbookEntity>();
            List<SR_UserEntity> entList = DataBase.Instance.tSR_User.Get_EntityCollection();
            if (entList != null)
            {
                Int32 i = 0;
                foreach (var item in entList)
                {
                    Panel p = new Panel();
                    p.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
                    p.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(141)))), ((int)(((byte)(141)))), ((int)(((byte)(141)))));
                    p.Location = new System.Drawing.Point(0, 29 * (i + 1));
                    p.Name = "pane_"+item.Id;
                    p.Size = new System.Drawing.Size(328, 1);
                    p.TabIndex = 12;

                    Label lbl1 = new Label();
                    lbl1.AutoSize = true;
                    lbl1.ForeColor = System.Drawing.Color.Black;
                    lbl1.Location = new System.Drawing.Point(12, 11 + (i * 30));
                    lbl1.Name = "label_"+item.Id+"_1";
                    lbl1.Size = new System.Drawing.Size(41, 12);
                    lbl1.TabIndex = 8;
                    lbl1.Text = item.Loginname;

                    Label lbl2 = new Label();
                    lbl2.AutoSize = true;
                    lbl2.ForeColor = System.Drawing.Color.Black;
                    lbl2.Location = new System.Drawing.Point(108, 11 + (i * 30));
                    lbl2.Name = "label_" + item.Id + "_2";
                    lbl2.Size = new System.Drawing.Size(29, 12);
                    lbl2.TabIndex = 9;
                    lbl2.Text = groupentList.Any(m => m.Id == item.Groupid) == false ? "" : groupentList.FirstOrDefault(m => m.Id == item.Groupid).Title;

                    Label lbl4 = new Label();
                    lbl4.AutoSize = true;
                    lbl4.ForeColor = System.Drawing.Color.Black;
                    lbl4.Location = new System.Drawing.Point(267, 11 + (i * 30));
                    lbl4.Name = "label_" + item.Id + "_3";
                    lbl4.Size = new System.Drawing.Size(29, 12);
                    lbl4.TabIndex = 11;
                    lbl4.Text = "删除";
                    lbl4.Tag = item.Id;
                    lbl4.Click += new System.EventHandler(this.lbl_Del_Click);

                    Label lbl3 = new Label();
                    lbl3.AutoSize = true;
                    lbl3.ForeColor = System.Drawing.Color.Black;
                    lbl3.Location = new System.Drawing.Point(232, 11 + (i * 30));
                    lbl3.Name = "label_" + item.Id + "_4";
                    lbl3.Size = new System.Drawing.Size(29, 12);
                    lbl3.TabIndex = 10;
                    lbl3.Text = "修改";
                    lbl3.Tag = item.Id;
                    lbl3.Click += new System.EventHandler(this.lbl_Edit_Click);

                    this.panel3.Controls.Add(p);
                    this.panel3.Controls.Add(lbl1);
                    this.panel3.Controls.Add(lbl2);
                    this.panel3.Controls.Add(lbl4);
                    this.panel3.Controls.Add(lbl3);

                    i++;
                }
            }
        }