private void ShowOneRoleValue(string RoleID)
        {
            Purview = AllRole[RoleID];

            this.textBox6.Text = RoleID;
            this.textBox7.Text = Purview.RoleName;
            //OldUsePurview = Purview.Clone();

            this.c1FlexGrid1.Rows.Count = this.c1FlexGrid1.Rows.Fixed;

            DataTable OnePower = null;
            try
            {
                OnePower = Purview.Power;
            }
            catch (Exception e)
            {
                //ShowMessageBox("070103", Purview.RoleID);
                //LogManager.LogManagerInstance.WriteLogOnError(programinfo, "ShowOneRoleValue", e);
                return;
            }

            int i = 0;
            //combolist = GetNewList(allProgramID);
            List<string> mycombolist = GetNewList(allProgramID);

            if (OnePower != null)
            {
                foreach (DataRow r in OnePower.Rows)
                {
                    if (r.RowState == DataRowState.Deleted)
                        continue;
                    i++;
                    this.c1FlexGrid1.AddItem(new object[] { i.ToString(), r[0], GetProgramName(r[0]), HaveNoneRole(r[1]), HaveReadRole(r[1]), HaveAllRole(r[1]) }).UserData = r;
                    if (mycombolist.Contains(r[0].ToString().Trim()))
                    {
                        mycombolist.Remove(r[0].ToString().Trim());
                    }
                }
            }

            string tempcombolist = String.Empty;
            for (int ip = 0; ip < mycombolist.Count; ip++)
            {
                tempcombolist += mycombolist[ip];
                if (ip != mycombolist.Count - 1)
                {
                    tempcombolist += "|";
                }
            }

            this.c1FlexGrid1.Cols[1].ComboList = tempcombolist;

            if (this.HasChanged)
                HasChanged = false;

            c1FlexGrid1AddOneLine();

            //this.c1FlexGrid1.AutoSizeCols(0,0,0);+
        }
        private void LoadAllRole()
        {
            AllRoleID = new List<string>();
            this.comboBox2.Items.Clear();
            allRole = new List<string>();
            DataTable dt = new DataTable();
            DataTable dt_power = new DataTable();

            AllRole = new Dictionary<string, UsePurview>();
            dt = ds.Tables["S_Role"];

            dt_power.Columns.Add("ProgramID");
            dt_power.Columns.Add("Power");
            dt_power.PrimaryKey = new DataColumn[] { dt_power.Columns[0] };
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                allRole.Add(dt.Rows[i][1].ToString().Trim());
                AllRoleID.Add(dt.Rows[i][0].ToString().Trim());

                dt_power = DBUser.Get_ProgramIDByRole(dt.Rows[i][0].ToString().Trim());

                UsePurview temp_UsePurview = new UsePurview();
                temp_UsePurview.SetUserAttribute(dt.Rows[i][0].ToString().Trim(), dt.Rows[i][1].ToString().Trim(), dt_power);
                AllRole.Add(dt.Rows[i][0].ToString().Trim(), temp_UsePurview);

            }

            this.comboBox2.Items.AddRange(AllRoleID.ToArray());
        }
        private void NewRole()
        {
            this.panel1.Visible = true;
            this.panel2.Visible = false;
            this.TotalRole.Visible = false;
            this.TotalUser.Visible = false;
            this.OnlyReadGrid.Visible = false;
            this.c1FlexGrid1.Visible = true;

            this.textBox6.ReadOnly = false;
            this.textBox6.BackColor = SystemColors.Window;

            this.textBox6.Text = String.Empty;
            this.textBox7.Text = String.Empty;
            this.comboBox2.Text = String.Empty;

            this.c1FlexGrid1.Rows.Count = this.c1FlexGrid1.Rows.Fixed;

            Purview = new UsePurview();
            DataTable dt = new DataTable();
            dt.Columns.Add("ProgramID");
            dt.Columns.Add("Power");
            dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
            Purview.Power = dt;

            List<string> mycombolist = GetNewList(allProgramID);
            string tempcombolist = String.Empty;
            for (int ip = 0; ip < mycombolist.Count; ip++)
            {
                tempcombolist += mycombolist[ip];
                if (ip != mycombolist.Count - 1)
                {
                    tempcombolist += "|";
                }
            }

            this.c1FlexGrid1.Cols[1].ComboList = tempcombolist;

            c1FlexGrid1AddOneLine();
            this.textBox6.Focus();
        }
示例#4
0
 /// <summary>
 /// ��ǰ����ĸ������������ݣ�
 /// </summary>
 /// <returns></returns>
 public UsePurview Clone()
 {
     UsePurview Temp = new UsePurview();
     Temp.SetUserAttribute(this.id,this.RoleName,this.power == null ? null:this.power.Copy());
     return Temp;
 }