Beispiel #1
0
        private void SetData()
        {
            List <ProductType> allProductType = ViewProductTypeController.GetAllProductTypeController();

            GridProductType.DataSource = allProductType;
            GridProductType.DataBind();
        }
        private void loadData()
        {
            List <ProductType> vPT = ViewProductTypeController.requestList();

            ptGrid.DataSource = vPT;
            ptGrid.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["user"] != null)
         {
             User us = (User)Session["user"];
             GridViewPT.Columns[0].Visible = false;
             GridViewPT.Columns[1].Visible = false;
             GridViewPT.Columns[2].Visible = false;
             if (us.RoleID == 1)
             {
                 GridViewPT.Columns[0].Visible = true;
                 GridViewPT.Columns[1].Visible = true;
                 GridViewPT.Columns[2].Visible = true;
                 GridViewPT.DataSource         = ViewProductTypeController.getAllPT();
                 GridViewPT.DataBind();
             }
         }
         else
         {
             Response.Redirect("Home.aspx");
         }
     }
 }
        protected void deleteBtn_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32((sender as LinkButton).CommandArgument);

            if (!ViewProductTypeController.requestDelete(id))
            {
                warningLbl.Text = "Cannot Delete This Product Type.";
            }
            else
            {
                Response.Redirect("./ViewProductType.aspx");
            }
        }
Beispiel #5
0
        protected void BtnDeleteProductType_Click(object sender, EventArgs e)
        {
            int    productTypeId = Int32.Parse((sender as LinkButton).CommandArgument);
            string errorMessage  = "";

            if (ViewProductTypeController.DeleteProductTypeController(productTypeId, out errorMessage) == false)
            {
                Response.Redirect("ViewProductType.aspx");
            }
            else
            {
                LblError.Text = errorMessage;
            }
        }
        protected void DeleteProductType_Click(object send, EventArgs e)
        {
            int    id       = Int32.Parse((send as LinkButton).CommandArgument);
            string errorMsg = "";
            bool   success  = ViewProductTypeController.validateDelete(id, out errorMsg);

            if (success)
            {
                Response.Redirect("ViewProductType.aspx");
            }
            else
            {
                lblDelete.Visible = true;
                lblDelete.Text    = errorMsg;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (ViewProductTypeController.isUserLoggedIn())
     {
         if (ViewProductTypeController.isUserAnAdmin(Request.Cookies["user_email"].Value))
         {
             loadData();
         }
         else
         {
             userWarnLbl.Text  = "403 You're not an admin";
             insertBtn.Visible = false;
         }
     }
     else
     {
         userWarnLbl.Text  = "403 You're not logged in!";
         logoutBtn.Visible = false;
         insertBtn.Visible = false;
     }
 }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["LoginSession"] == null)
     {
         Response.Redirect("../HomeView/Home.aspx");
     }
     else
     {
         String ID   = Session["LoginSession"].ToString();
         MsUser user = HomeController.FetchDataForHome(ID);
         if (user.RoleID != "RL1")
         {
             Response.Redirect("../HomeView/Home.aspx");
         }
         else
         {
             GridView1.DataSource = ViewProductTypeController.FetchFromDB();
             GridView1.DataBind();
         }
     }
 }