protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userrole"].ToString() != "Administrator")
            {
                Response.Redirect("Home.aspx");
            }

            if (Request.QueryString["ID"] == null)
            {
                inputPaymentType.Attributes["value"] = null;

                errorMsg.Text = "Belum memilih payment type, silahkan kembali";
                errorMsg.Style.Add("visibility", "visible");
            }
            else if (Request.QueryString["ID"] != null)
            {
                int         id = Int32.Parse(Request.QueryString["ID"]);
                PaymentType pt = ItemAuthHandler.checkExistPaymentTypeId(id);

                if (pt == null)
                {
                    inputPaymentType.Attributes["value"] = null;
                    errorMsg.Text = "payment type tidak ditemukan";
                    errorMsg.Style.Add("visibility", "visible");
                }
                else
                {
                    inputPaymentType.Attributes["value"] = pt.type.ToString();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List <Product> product = ItemAuthHandler.getProducts();

            var dataSource = product.Select(x => new
            {
                x.productID,
                x.productName,
                x.productStock,
                x.ProductType.productTypeName,
                x.productPrice
            });

            viewProduct.DataSource = dataSource;
            viewProduct.DataBind();

            if (Session["userrole"].ToString() == "Administrator")
            {
                adminPvl.Style.Add("display", "inline");
            }
            else
            {
                adminPvl.Style.Add("display", "none");
            }
        }
        public static Boolean checkProductTypeOnProduct(int id)
        {
            Product product = ItemAuthHandler.checkProductTypeOnProduct(id);

            if (product != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static Boolean checkExistUser(string username)
        {
            User user = ItemAuthHandler.checkExistUser(username);

            if (user != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static Boolean checkPaymentTypeId(int id)
        {
            PaymentType pt = ItemAuthHandler.checkExistPaymentTypeId(id);

            if (pt != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //start here -andre-
        public static Boolean checkPaymentType(string typeName)
        {
            PaymentType pt = ItemAuthHandler.checkExistPaymentType(typeName);

            if (pt != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            viewPaymentType.DataSource = ItemAuthHandler.getPaymentType();
            viewPaymentType.DataBind();

            if (Session["userrole"].ToString() == "Administrator")
            {
                adminPvl.Style.Add("display", "inline");
            }
            else
            {
                adminPvl.Style.Add("display", "none");
            }
        }
        public static Boolean checkExistUserId(int id, out string userPassword)
        {
            User curr = ItemAuthHandler.checkExistUserId(id);

            userPassword = curr.userPassword.ToString();

            if (curr != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static Boolean checkExistUserId2(int id, out string userEmail, out string userName, out string userGender)
        {
            User curr = ItemAuthHandler.checkExistUserId(id);

            userEmail  = curr.userEmail.ToString();
            userName   = curr.userName.ToString();
            userGender = curr.userGender.ToString();

            if (curr != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userid"] != null)
            {
                loginProp1.Style.Add("display", "none");
                userProp1.Style.Add("display", "inline");
                viewProp1.Style.Add("display", "inline");
                viewProp2.Style.Add("display", "none");
                viewmem.Style.Add("display", "inline");

                linkUser.InnerHtml = Session["username"].ToString();

                if (Session["userrole"].ToString() == "Administrator")
                {
                    viewProp2.Style.Add("display", "inline");
                    viewProp1.Style.Add("display", "none");
                    viewmem.Style.Add("display", "none");
                }
            }
            else
            {
                Session["userrole"] = "Guest";
                loginProp1.Style.Add("display", "inline");
                userProp1.Style.Add("display", "none");
                viewProp1.Style.Add("display", "inline");
                viewProp2.Style.Add("display", "none");
                viewmem.Style.Add("display", "none");
            }

            List <Product> prod = ItemAuthHandler.getRandProduct();

            var list = from p in prod
                       where p != null
                       select new
            {
                p.productName,
                p.ProductType.productTypeName,
                p.productStock,
                p.productPrice
            };

            GridView1.DataSource = list;
            GridView1.DataBind();
        }
Esempio n. 11
0
        public static Boolean checkUser(string email, string password, out string userid, out string username, out string useremail, out string userrole)
        {
            User user = ItemAuthHandler.checkUser(email, password);

            userid    = user.userID.ToString();
            username  = user.userName.ToString();
            useremail = user.userEmail.ToString();
            int roleId = user.RoleID.Value;

            Role role = ItemAuthHandler.getRoleUser(roleId);

            userrole = role.roleName.ToString();

            if (user != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 12
0
 public static List <PaymentType> getPaymentType()
 {
     return(ItemAuthHandler.getPaymentType());
 }
Esempio n. 13
0
 public static List <User> getUser()
 {
     return(ItemAuthHandler.getUser());
 }
Esempio n. 14
0
 public static List <ProductType> getProductType()
 {
     return(ItemAuthHandler.getProductType());
 }
Esempio n. 15
0
 public static List <Product> getProduct()
 {
     return(ItemAuthHandler.getProducts());
 }