Ejemplo n.º 1
0
        private void OnUserSelected(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
        {
            //Event handler for user selcted in the grid
            try {
                this.mRoles.Clear();
                this.mUserRoles.Clear();
                string userName = this.grdMain.Selected.Rows[0].Cells["UserName"].Value.ToString();

                this.mUserRoles.Merge(ApplicationServicesGateway.GetRolesForUser("Argix", userName));
                MembershipDataset roles = new MembershipDataset();
                roles.Merge(ApplicationServicesGateway.GetRoles("Argix"));
                for (int i = 0; i < this.mUserRoles.RoleTable.Count; i++)
                {
                    MembershipDataset.RoleTableRow[] rows = (MembershipDataset.RoleTableRow[])roles.RoleTable.Select("RoleName='" + this.mUserRoles.RoleTable[i].RoleName + "'");
                    if (rows != null && rows.Length > 0)
                    {
                        roles.RoleTable.RemoveRoleTableRow(rows[0]);
                    }
                }
                roles.RoleTable.AcceptChanges();
                this.mRoles.Merge(roles);
            }
            catch (Exception ex) { App.ReportError(ex); }
            finally { setUserServices(); }
        }
Ejemplo n.º 2
0
        public MembershipDataset GetUsers()
        {
            MembershipDataset users = new MembershipDataset();

            try {
                DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_USERS, TBL_USERS, new object[] { "Tracking", 0, 800 });
                if (ds.Tables[TBL_USERS] != null && ds.Tables[TBL_USERS].Rows.Count > 0)
                {
                    users.Merge(ds);
                }
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message); }
            return(users);
        }
Ejemplo n.º 3
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            //Event handler for form load event
            this.Cursor = Cursors.WaitCursor;
            try {
                //Show early
                Splash.Close();
                this.Visible = true;
                Application.DoEvents();
                this.Font = this.msMain.Font = this.tsMain.Font = this.ssMain.Font = global::Argix.Properties.Settings.Default.Font;

                //Determine authorization
                string name = Environment.UserDomainName.ToLower() + "\\" + Environment.UserName.ToLower();
                if (name != "argix\\jheary")
                {
                    MembershipDataset roles = new MembershipDataset();
                    DataSet           ds    = ApplicationServicesGateway.GetRolesForUser("Argix", name);
                    if (ds != null)
                    {
                        roles.Merge(ds);
                    }
                    if (roles.RoleTable.Rows.Count > 0)
                    {
                        DataRow[] _roles = roles.RoleTable.Select("RoleName='" + "administrator" + "'");
                        if (_roles.Length > 0)
                        {
                            this.mIsAdmin = true;
                        }
                    }
                }
                else
                {
                    this.mIsAdmin = true;
                }

                this.ssMain.SetTerminalPanel("0", "PRODUCTION");
                this.msViewRefresh.PerformClick();
            }
            catch (Exception ex) { App.ReportError(ex); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }