Exemple #1
0
        private void GetTreeViewNode(TreeNode Tn)
        {
            if (Tn.Checked)
            {
                string pgm_up = "";

                if (Tn.Parent != null)
                {
                    pgm_up = Tn.Parent.Name;
                }
                string        _is_lowest = Convert.ToString(Tn.Tag);
                BindingSource _bdSource  = new BindingSource();
                _bdSource = dataGridView1.DataSource as BindingSource;

                UsrManageModel _usrMge = null;
                if (PgmPowerStateList.ContainsKey(Tn.Name))
                {
                    _usrMge = PgmPowerStateList[Tn.Name];
                }
                if (_usrMge != null)
                {
                    _treeString.Append("Insert Into RolePgm1(Company_Id,Role_Id,Pgm_Id,ShortName_01,Query_Rights_Id,Insert_Rights_Id,Update_Rights_Id,Delete_Rights_Id,Print_Rights_Id,"
                                       + "Pgm_Up,Itm,Level_Id,Is_Lowest)"
                                       + "SELECT Company_Id=@Company_Id,Role_Id=@Role_Id,Pgm_Id='" + Tn.Name + "',ShortName_01='" + Tn.Text + "', "
                                       + "Query_Rights_Id='" + _usrMge.Query_Rights_Id + "',Insert_Rights_Id='" + _usrMge.Insert_Rights_Id + "', "
                                       + "Update_Rights_Id='" + _usrMge.Update_Rights_Id + "',Delete_Rights_Id='" + _usrMge.Delete_Rights_Id + "',Print_Rights_Id='" + _usrMge.Print_Rights_Id + "',"
                                       + "Pgm_Up='" + pgm_up + "',Itm='" + _usrMge.Itm + "',Level_Id='" + (Tn.Level + 1) + "',"
                                       + "Is_Lowest='" + _is_lowest + "';");
                }

                //DataRow[] _dr = _dtRole.Select("Pgm_Id='" + Tn.Name + "'");
                //if (_dr != null && _dr.Length > 0)
                //{
                //    _treeString.Append("Insert Into RolePgm1(Company_Id,Role_Id,Pgm_Id,ShortName_01,Query_Rights_Id,Insert_Rights_Id,Update_Rights_Id,Delete_Rights_Id,Print_Rights_Id,"
                //       + "Pgm_Up,Itm,Level_Id,Is_Lowest)"
                //       + "SELECT Company_Id=@Company_Id,Role_Id=@Role_Id,Pgm_Id='" + Tn.Name + "',ShortName_01='" + Tn.Text + "', "
                //       + "Query_Rights_Id='" + _dr[0]["Query_Rights_Id"].ToString() + "',Insert_Rights_Id='" + _dr[0]["Insert_Rights_Id"].ToString() + "', "
                //       + "Update_Rights_Id='" + _dr[0]["Update_Rights_Id"].ToString() + "',Delete_Rights_Id='" + _dr[0]["Delete_Rights_Id"].ToString() + "',Print_Rights_Id='" + _dr[0]["Print_Rights_Id"].ToString() + "',"
                //       + "Pgm_Up='" + pgm_up + "',Itm='" + _dr[0]["Itm"].ToString() + "',Level_Id='" + (Tn.Level + 1) + "',"
                //       + "Is_Lowest='" + _is_lowest + "';");
                //}
            }
            foreach (TreeNode tnSub in Tn.Nodes)
            {
                GetTreeViewNode(tnSub);
            }
        }
Exemple #2
0
 private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         UsrManageModel pmgPowState = new  UsrManageModel();
         pmgPowState.Pgm_Id           = (string)dataGridView1.Rows[e.RowIndex].Cells["Pgm_Id"].Value;
         pmgPowState.Name             = (string)dataGridView1.Rows[e.RowIndex].Cells["Name_Body"].Value;
         pmgPowState.Query_Rights_Id  = dataGridView1.Rows[e.RowIndex].Cells["Query_Rights_Id"].Value.ToString();
         pmgPowState.Insert_Rights_Id = dataGridView1.Rows[e.RowIndex].Cells["Insert_Rights_Id"].Value.ToString();
         pmgPowState.Update_Rights_Id = dataGridView1.Rows[e.RowIndex].Cells["Update_Rights_Id"].Value.ToString();
         pmgPowState.Print_Rights_Id  = dataGridView1.Rows[e.RowIndex].Cells["Print_Rights_Id"].Value.ToString();
         pmgPowState.Export_Rights_Id = dataGridView1.Rows[e.RowIndex].Cells["Export_Rights_Id"].Value.ToString();
         pmgPowState.Delete_Rights_Id = dataGridView1.Rows[e.RowIndex].Cells["Delete_Rights_Id"].Value.ToString();
         pmgPowState.Itm = CommomHelper.ToInt(dataGridView1.Rows[e.RowIndex].Cells["Itm"].Value);
         if (PgmPowerStateList.ContainsKey(pmgPowState.Pgm_Id))
         {
             PgmPowerStateList[pmgPowState.Pgm_Id] = pmgPowState;
         }
         else
         {
             PgmPowerStateList.Add(pmgPowState.Pgm_Id, pmgPowState);
         }
     }
 }
Exemple #3
0
        void LoadSysPgm(DataTable _dt)
        {
            //  dataGridView1.Rows.Clear();
            //  dataGridView1.Columns.Clear();
            //  dataGridView1.Columns.AddRange(new DataGridViewColumn[] {
            //  Pgm_Id,
            //  Name_Body,
            //  Query_Rights_Id,
            //  Insert_Rights_Id,
            //  Update_Rights_Id,
            //  Delete_Rights_Id,
            //  Print_Rights_Id,
            //  Export_Rights_Id
            //});
            dataGridView1.Rows.Clear();
            foreach (DataRow row in _dt.Rows)
            {
                UsrManageModel pgmPowState = null;
                //try
                //{
                //     pgmPowState = PgmPowerStateList[row["Pgm_Id"].ToString()];
                //}
                //catch
                //{
                //     pgmPowState = new UsrManageModel()
                //    {
                //        Pgm_Id = row["Pgm_Id"].ToString(),
                //        Name = row["Name"].ToString(),
                //        Insert_Rights_Id = "F",
                //        Delete_Rights_Id = "F",
                //        Update_Rights_Id = "F",
                //        Print_Rights_Id = "F",
                //        Query_Rights_Id = "F",
                //        Export_Rights_Id = "F",
                //        Itm = CommomHelper.ToInt(row["Itm"])
                //    };
                //}
                if (PgmPowerStateList != null && PgmPowerStateList.Count > 0 && PgmPowerStateList.ContainsKey(row["Pgm_Id"].ToString()))
                {
                    pgmPowState = PgmPowerStateList[row["Pgm_Id"].ToString()];
                }
                else
                {
                    pgmPowState = new UsrManageModel()
                    {
                        Pgm_Id           = row["Pgm_Id"].ToString(),
                        Name             = row["Name"].ToString(),
                        Insert_Rights_Id = row["Insert_Rights_Id"].ToString(),
                        Delete_Rights_Id = row["Delete_Rights_Id"].ToString(),
                        Update_Rights_Id = row["Update_Rights_Id"].ToString(),
                        Print_Rights_Id  = row["Print_Rights_Id"].ToString(),
                        Query_Rights_Id  = row["Query_Rights_Id"].ToString(),
                        Export_Rights_Id = row["Export_Rights_Id"].ToString(),
                        Itm = CommomHelper.ToInt(row["Itm"])
                    };
                }
                DataGridViewRow r = new DataGridViewRow();
                r.CreateCells(dataGridView1, new object[] {
                    row["Pgm_Id"],
                    row["Name"],
                    pgmPowState.Query_Rights_Id,
                    pgmPowState.Insert_Rights_Id,
                    pgmPowState.Update_Rights_Id,
                    pgmPowState.Delete_Rights_Id,
                    pgmPowState.Print_Rights_Id,
                    pgmPowState.Export_Rights_Id,
                    pgmPowState.Itm
                });
                dataGridView1.Rows.Add(r);
            }

            _dt.Dispose();
        }