Ejemplo n.º 1
0
        private void GetRoleValues()
        {
            string RoleName     = string.Empty;
            string FunctionName = string.Empty;
            string CurBox       = string.Empty;

            foreach (Control Ctl in tpRoles.Controls)
            {
                if (Ctl is CheckBox)
                {
                    ((CheckBox)Ctl).Checked = false;
                }
            }

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetRoleValues();

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            RoleName     = row["RoleName"].ToString();
                            FunctionName = row["FunctionName"].ToString();

                            foreach (Control Ctl in tpRoles.Controls)
                            {
                                if (Ctl is CheckBox)
                                {
                                    if (((CheckBox)Ctl).Tag.ToString() == FunctionName)
                                    {
                                        CurBox = ((CheckBox)Ctl).Name;

                                        if (RoleName == "Developer")
                                        {
                                            if (CurBox.Contains("cDev"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }

                                        if (RoleName == "Releaser UAT")
                                        {
                                            if (CurBox.Contains("cUAT"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }

                                        if (RoleName == "Releaser Pre-Production")
                                        {
                                            if (CurBox.Contains("cPreProd"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }

                                        if (RoleName == "Releaser Production")
                                        {
                                            if (CurBox.Contains("cProd"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }

                                        if (RoleName == "Administrator")
                                        {
                                            if (CurBox.Contains("cAdmin"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }

                                        if (RoleName == "Final Approver")
                                        {
                                            if (CurBox.Contains("cApproverFinal"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }

                                        if (RoleName == "Testing Approver")
                                        {
                                            if (CurBox.Contains("cApproverTesting"))
                                            {
                                                ((CheckBox)Ctl).Checked = true;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            catch
            {
                throw;
            }
        }