Example #1
0
        private void showButton(string RoleId, int ShowId, int UserId)
        {
            this.btnOrder.Visible  = true;
            this.btnUpdate.Visible = true;

            // Kalau Buyer
            if (RoleId.Equals("1"))
            {
                btnUpdate.Visible = false;
                btnDelete.Visible = false;

                Button button = this.Master.FindControl("btnHomeOnNav") as Button;
                button.Visible = true;

                button         = this.Master.FindControl("btnAddShowOnNav") as Button;
                button.Visible = false;

                button         = this.Master.FindControl("btnReportsOnNav") as Button;
                button.Visible = false;

                button         = this.Master.FindControl("btnLoginOnNav") as Button;
                button.Visible = false;

                button         = this.Master.FindControl("btnRegisterOnNav") as Button;
                button.Visible = false;

                button         = this.Master.FindControl("btnTransactionOnNav") as Button;
                button.Visible = true;

                button         = this.Master.FindControl("btnAccountOnNav") as Button;
                button.Visible = true;

                button         = this.Master.FindControl("btnRedeemOnNav") as Button;
                button.Visible = true;

                button         = this.Master.FindControl("btnLogoutOnNav") as Button;
                button.Visible = true;
            }
            // Kalau Seller
            else if (RoleId.Equals("2") && ShowController.CheckShowWithSeller(ShowId, UserId))
            {
                btnOrder.Visible = false;
                navForSeller();
            }
            else
            {
                btnOrder.Visible  = false;
                btnUpdate.Visible = false;
                btnDelete.Visible = false;

                if (!RoleId.Equals("2"))
                {
                    Button button = this.Master.FindControl("btnHomeOnNav") as Button;
                    button.Visible = true;

                    button         = this.Master.FindControl("btnAddShowOnNav") as Button;
                    button.Visible = false;

                    button         = this.Master.FindControl("btnReportsOnNav") as Button;
                    button.Visible = false;

                    button         = this.Master.FindControl("btnLoginOnNav") as Button;
                    button.Visible = true;

                    button         = this.Master.FindControl("btnRegisterOnNav") as Button;
                    button.Visible = true;

                    button         = this.Master.FindControl("btnTransactionOnNav") as Button;
                    button.Visible = false;

                    button         = this.Master.FindControl("btnAccountOnNav") as Button;
                    button.Visible = false;

                    button         = this.Master.FindControl("btnRedeemOnNav") as Button;
                    button.Visible = true;

                    button         = this.Master.FindControl("btnLogoutOnNav") as Button;
                    button.Visible = false;
                }
                else
                {
                    navForSeller();
                }
            }
        }