Exemple #1
0
 void FrmUsers_Load(object sender, EventArgs e)
 {
     //throw new NotImplementedException();
     RIPP.NIR.Controls.StyleTool.FormatGrid(ref this.dataGridView1);
     this.SetHeader();
     using (var db = new NIRCeneterEntities())
     {
         var lst = db.S_User;
         foreach (var u in lst)
         {
             var row = new mydatarow()
             {
                 User     = u,
                 IsEdited = false,
                 IsNew    = false
             };
             row.CreateCells(this.dataGridView1,
                             u.loginName,
                             u.IsDeleted ? "停用" : "正常",
                             "******",
                             u.realName,
                             u.tel,
                             u.email,
                             u.Role.GetDescription());
             //显示不同的颜色
             if ((this._user.Role == RoleEnum.Engineer && u.Role == RoleEnum.Engineer) && this._user.ID != u.ID)
             {
                 row.DefaultCellStyle.BackColor = Color.FromArgb(240, 240, 240);
             }
             this.dataGridView1.Rows.Add(row);
         }
     }
 }
Exemple #2
0
 private void renderGrid(UsageTypeEnum u)
 {
     this.dataGridView1.Rows.Clear();
     for (int i = 0; i < this._olib.Count; i++)
     {
         if (u == UsageTypeEnum.Node || this._olib[i].Usage == u)
         {
             var row = new mydatarow()
             {
                 S = this._nlib.Specs[i]
             };
             row.CreateCells(this.dataGridView1, this._nlib.Specs[i].Name, this._nlib.Specs[i].Usage.GetDescription());
             this.dataGridView1.Rows.Add(row);
         }
     }
 }
Exemple #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var u = new S_User()
            {
                addTime = DateTime.Now
            };
            var row = new mydatarow()
            {
                User     = u,
                IsNew    = true,
                IsEdited = false
            };

            row.CreateCells(this.dataGridView1,
                            "",                     //loginName
                            "正常",
                            "",                     //password
                            "",                     //realName
                            "",                     //tel
                            "",                     //email
                            u.Role.GetDescription() //role
                            );
            this.dataGridView1.Rows.Add(row);
        }
Exemple #4
0
        public void ShowMotheds(BindModel model)
        {
            if (model == null)
            {
                return;
            }
            this._model = model;
            this.dataGridView1.Rows.Clear();
            this.dataGridView2.Columns.Clear();

            //填充方法信息
            if (model.IdModels != null)
            {
                foreach (var m in model.IdModels)
                {
                    var row = new mydatarow()
                    {
                        Model = m, Method = PredictMethod.Identify
                    };
                    row.CreateCells(this.dataGridView1, m.Name,
                                    "识别",
                                    m.Creater,
                                    m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                    m.SpecLib.FirstOrDefault().Components.Count,
                                    m.SpecLib.Count);
                    dataGridView1.Rows.Add(row);
                }
            }
            if (model.FitModels != null)
            {
                foreach (var m in model.FitModels)
                {
                    var row = new mydatarow()
                    {
                        Model = m, Method = PredictMethod.Fitting
                    };
                    row.CreateCells(this.dataGridView1, m.Name,
                                    "拟合",
                                    m.Creater,
                                    m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                    m.SpecLib.FirstOrDefault().Components.Count,
                                    m.SpecLib.Count,
                                    m.SpecLib.Count);
                    dataGridView1.Rows.Add(row);
                }
            }
            if (model.PLS != null)
            {
                var row = new mydatarow()
                {
                    Model = model.PLS, Method = PredictMethod.PLSBind
                };
                var m = model.PLS;
                row.CreateCells(this.dataGridView1, m.Name,
                                "PLS",
                                m.Creater,
                                m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                m.SubModels.Count);
                dataGridView1.Rows.Add(row);
            }
            if (model.Itg != null)
            {
                var row = new mydatarow()
                {
                    Model = model.Itg, Method = PredictMethod.Integrate
                };
                var m = model.Itg;
                row.CreateCells(this.dataGridView1, m.Name,
                                "集成包",
                                m.Creater,
                                m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                m.Comps.Count);
                dataGridView1.Rows.Add(row);
            }

            //填充性质信息
            this.dataGridView2.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "性质",
                Width      = 80
            });

            var trow = new DataGridViewRow();

            trow.CreateCells(this.dataGridView2, "");
            this.dataGridView2.Rows.Add(trow);
            if (model.IdModels != null)
            {
                foreach (var m in model.IdModels)
                {
                    var col = new DataGridViewTextBoxColumn()
                    {
                        HeaderText = "识别",
                        Width      = 60
                    };
                    this.dataGridView2.Columns.Add(col);
                    this.dataGridView2[col.Index, 0].Value = m.Name;
                    foreach (var c in m.SpecLib.FirstOrDefault().Components)
                    {
                        int ridx = findRowIndex(c.Name);
                        if (ridx >= 0)
                        {
                            this.dataGridView2[col.Index, ridx].Value = "是";
                        }
                        else
                        {
                            var row = new DataGridViewRow();
                            row.Tag = c.Name;
                            row.CreateCells(this.dataGridView2, c.Name);
                            this.dataGridView2.Rows.Add(row);
                            this.dataGridView2[col.Index, row.Index].Value = "是";
                        }
                    }
                }
            }
            if (model.FitModels != null)
            {
                foreach (var m in model.FitModels)
                {
                    var col = new DataGridViewTextBoxColumn()
                    {
                        HeaderText = "拟合",
                        Width      = 60
                    };
                    this.dataGridView2.Columns.Add(col);
                    this.dataGridView2[col.Index, 0].Value = m.Name;
                    foreach (var c in m.SpecLib.FirstOrDefault().Components)
                    {
                        int ridx = findRowIndex(c.Name);
                        if (ridx >= 0)
                        {
                            this.dataGridView2[col.Index, ridx].Value = "是";
                        }
                        else
                        {
                            var row = new DataGridViewRow();
                            row.Tag = c.Name;
                            row.CreateCells(this.dataGridView2, c.Name);
                            this.dataGridView2.Rows.Add(row);
                            this.dataGridView2[col.Index, row.Index].Value = "是";
                        }
                    }
                }
            }
            if (model.PLS != null)
            {
                var col = new DataGridViewTextBoxColumn()
                {
                    HeaderText = "PLS",
                    Width      = 60
                };
                this.dataGridView2.Columns.Add(col);
                this.dataGridView2[col.Index, 0].Value = model.PLS.Name;
                foreach (var m in model.PLS.SubModels)
                {
                    // this.dataGridView2[col.Index, 0].Value = m.Name;
                    var c = m.Comp;

                    int ridx = findRowIndex(c.Name);
                    if (ridx >= 0)
                    {
                        this.dataGridView2[col.Index, ridx].Value = "是";
                    }
                    else
                    {
                        var row = new DataGridViewRow();
                        row.Tag = c.Name;
                        row.CreateCells(this.dataGridView2, c.Name);
                        this.dataGridView2.Rows.Add(row);
                        this.dataGridView2[col.Index, row.Index].Value = "是";
                    }
                }
            }
            if (model.Itg != null)
            {
                var col = new DataGridViewTextBoxColumn()
                {
                    HeaderText = "集成包",
                    Width      = 60
                };
                this.dataGridView2.Columns.Add(col);
                this.dataGridView2[col.Index, 0].Value = model.Itg.Name;
                foreach (var c in model.Itg.Comps)
                {
                    // this.dataGridView2[col.Index, 0].Value = m.Name;
                    int ridx = findRowIndex(c.Name);
                    if (ridx >= 0)
                    {
                        this.dataGridView2[col.Index, ridx].Value = "是";
                    }
                    else
                    {
                        var row = new DataGridViewRow();
                        row.Tag = c.Name;
                        row.CreateCells(this.dataGridView2, c.Name);
                        this.dataGridView2.Rows.Add(row);
                        this.dataGridView2[col.Index, row.Index].Value = "是";
                    }
                }
            }

            this.dataGridView2.Columns.Add(new DataGridViewTextBoxColumn()
            {
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            });
        }
        public void ShowMotheds(IntegratePropertyModel model)
        {
            if (model == null)
            {
                return;
            }
            this._model = model;
            this.dataGridView1.Rows.Clear();
            this.dataGridView2.Columns.Clear();

            //填充方法信息
            if (model.Identify != null)
            {
                foreach (var m in model.Identify)
                {
                    var row = new mydatarow()
                    {
                        Model = m, Method = PredictMethod.Identify
                    };
                    row.CreateCells(this.dataGridView1, m.Name,
                                    "识别",
                                    m.Creater,
                                    m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                    m.SpecLib.FirstOrDefault().Components.Count,
                                    m.SpecLib.Count);
                    dataGridView1.Rows.Add(row);
                }
            }
            if (model.Fittings != null)
            {
                foreach (var m in model.Fittings)
                {
                    var row = new mydatarow()
                    {
                        Model = m, Method = PredictMethod.Fitting
                    };
                    row.CreateCells(this.dataGridView1, m.Name,
                                    "拟合",
                                    m.Creater,
                                    m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                    m.SpecLib.FirstOrDefault().Components.Count,
                                    m.SpecLib.Count,
                                    m.SpecLib.Count);
                    dataGridView1.Rows.Add(row);
                }
            }
            if (model.PLS1 != null)
            {
                var row = new mydatarow()
                {
                    Model = model.PLS1, Method = PredictMethod.PLS1
                };
                var m = model.PLS1;
                row.CreateCells(this.dataGridView1, m.Name,
                                "PLS1",
                                m.Creater,
                                m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                1);
                dataGridView1.Rows.Add(row);
            }
            if (model.PLSANN != null)
            {
                var row = new mydatarow()
                {
                    Model = model.PLSANN, Method = PredictMethod.PLSANN
                };
                var m = model.PLSANN;
                row.CreateCells(this.dataGridView1, m.Name,
                                "PLS-ANN",
                                m.Creater,
                                m.CreateTime.ToString("yy-MM-dd HH:mm"),
                                1);
                dataGridView1.Rows.Add(row);
            }

            //填充性质信息
            this.dataGridView2.Columns.Add(new DataGridViewCheckBoxColumn()
            {
                HeaderText = "选中",
                Width      = 60,
                SortMode   = DataGridViewColumnSortMode.Programmatic
            });
            this.dataGridView2.Columns.Add(new DataGridViewTextBoxColumn()
            {
                HeaderText = "性质",
                Width      = 80,
                SortMode   = DataGridViewColumnSortMode.Programmatic
            });

            var trow = new DataGridViewRow();

            trow.CreateCells(this.dataGridView2, false);
            this.dataGridView2.Rows.Add(trow);
            if (model.Identify != null)
            {
                foreach (var m in model.Identify)
                {
                    var col = new DataGridViewTextBoxColumn()
                    {
                        HeaderText = "识别",
                        Width      = 60,
                        SortMode   = DataGridViewColumnSortMode.Programmatic
                    };
                    this.dataGridView2.Columns.Add(col);
                    this.dataGridView2[col.Index, 0].Value = m.Name;
                    foreach (var c in m.SpecLib.FirstOrDefault().Components)
                    {
                        int ridx = findRowIndex(c.Name);
                        if (ridx >= 0)
                        {
                            this.dataGridView2[col.Index, ridx].Value = "是";
                        }
                        else
                        {
                            var row = new DataGridViewRow();
                            row.Tag = c.Name;
                            row.CreateCells(this.dataGridView2, false, c.Name);
                            this.dataGridView2.Rows.Add(row);
                            this.dataGridView2[col.Index, row.Index].Value = "是";
                        }
                    }
                }
            }
            if (model.Fittings != null)
            {
                foreach (var m in model.Fittings)
                {
                    var col = new DataGridViewTextBoxColumn()
                    {
                        HeaderText = "拟合",
                        Width      = 60,
                        SortMode   = DataGridViewColumnSortMode.Programmatic
                    };
                    this.dataGridView2.Columns.Add(col);
                    this.dataGridView2[col.Index, 0].Value = m.Name;
                    foreach (var c in m.SpecLib.FirstOrDefault().Components)
                    {
                        int ridx = findRowIndex(c.Name);
                        if (ridx >= 0)
                        {
                            this.dataGridView2[col.Index, ridx].Value = "是";
                        }
                        else
                        {
                            var row = new DataGridViewRow();
                            row.Tag = c.Name;
                            row.CreateCells(this.dataGridView2, false, c.Name);
                            this.dataGridView2.Rows.Add(row);
                            this.dataGridView2[col.Index, row.Index].Value = "是";
                        }
                    }
                }
            }
            if (model.PLS1 != null)
            {
                var col = new DataGridViewTextBoxColumn()
                {
                    HeaderText = "PLS1",
                    Width      = 60,
                    SortMode   = DataGridViewColumnSortMode.Programmatic
                };
                this.dataGridView2.Columns.Add(col);
                this.dataGridView2[col.Index, 0].Value = model.PLS1.Name;

                int ridx = findRowIndex(model.PLS1.Comp.Name);
                if (ridx >= 0)
                {
                    this.dataGridView2[col.Index, ridx].Value = "是";
                }
                else
                {
                    var row = new DataGridViewRow();
                    row.Tag = model.PLS1.Comp.Name;
                    row.CreateCells(this.dataGridView2, false, model.PLS1.Comp.Name);
                    this.dataGridView2.Rows.Add(row);
                    this.dataGridView2[col.Index, row.Index].Value = "是";
                }
            }
            if (model.PLSANN != null)
            {
                var col = new DataGridViewTextBoxColumn()
                {
                    HeaderText = "PLS-ANN",
                    Width      = 60,
                    SortMode   = DataGridViewColumnSortMode.Programmatic
                };
                this.dataGridView2.Columns.Add(col);
                this.dataGridView2[col.Index, 0].Value = model.PLSANN.Name;

                int ridx = findRowIndex(model.PLSANN.Comp.Name);
                if (ridx >= 0)
                {
                    this.dataGridView2[col.Index, ridx].Value = "是";
                }
                else
                {
                    var row = new DataGridViewRow();
                    row.Tag = model.PLSANN.Comp.Name;
                    row.CreateCells(this.dataGridView2, false, model.PLSANN.Comp.Name);
                    this.dataGridView2.Rows.Add(row);
                    this.dataGridView2[col.Index, row.Index].Value = "是";
                }
            }

            if (model.Comp != null)
            {
                var idx = findRowIndex(model.Comp.Name);
                if (idx >= 0)
                {
                    this.dataGridView2[0, idx].Value = true;
                }
            }

            this.dataGridView2.Columns.Add(new DataGridViewTextBoxColumn()
            {
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
            });
        }