Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SessionUserGroup"].ToString() != "0")
            {
                Response.Redirect("Home.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    SqlConnection  ProgramFilesCon     = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProgramFilesDB;Data Source=ACER-PC\\SQLEXPRESS");
                    SqlDataAdapter ProgramFilesAdapter = new SqlDataAdapter();
                    DataTable      ProgramFilesTable   = new DataTable();
                    ProgramFilesCon.Open();

                    SqlCommand PopulateOMRepeater = new SqlCommand("select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID", ProgramFilesCon);
                    ProgramFilesAdapter.SelectCommand = PopulateOMRepeater;
                    ProgramFilesAdapter.Fill(ProgramFilesTable);
                    ProgramFilesAdapter.Dispose();
                    PopulateOMRepeater.Dispose();
                    ProgramFilesCon.Close();
                    RepeaterEditOS.DataSource = ProgramFilesTable;
                    RepeaterEditOS.DataBind();
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["SessionUserName"] != null)
        {
            if (!IsPostBack)
            {
                LabelUserWelcome.Text = Session["SessionUserName"].ToString();
                LabelCartID.Text      = Session["SessionCartID"].ToString();
                LabelUserID.Text      = Session["SessionUserID"].ToString();
                SqlConnection  UserAreaPFCon = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProgramFilesDB;Data Source=ACER-PC\\SQLEXPRESS");
                SqlDataAdapter PFAdapter     = new SqlDataAdapter();
                DataTable      PFTable       = new DataTable();

                string UserID   = LabelUserID.Text;
                string username = Session["SessionUserName"].ToString();
                UserAreaPFCon.Open();
                SqlCommand LoadUserData = new SqlCommand("select FullName, Email, UserAddress, City, Phone from Users where Username='******'", UserAreaPFCon);
                PFAdapter.SelectCommand = LoadUserData;
                PFAdapter.Fill(PFTable);
                PFAdapter.Dispose();
                LoadUserData.Dispose();
                UserAreaPFCon.Close();
                Repeater1.DataSource = PFTable;
                Repeater1.DataBind();

                SqlConnection  ProgramFilesCon     = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProgramFilesDB;Data Source=ACER-PC\\SQLEXPRESS");
                SqlDataAdapter ProgramFilesAdapter = new SqlDataAdapter();
                DataTable      ProgramFilesTable   = new DataTable();
                ProgramFilesCon.Open();

                SqlCommand PopulateUARepeater = new SqlCommand("select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID and c.UserID=" + UserID + "", ProgramFilesCon);
                ProgramFilesAdapter.SelectCommand = PopulateUARepeater;
                ProgramFilesAdapter.Fill(ProgramFilesTable);
                ProgramFilesAdapter.Dispose();
                PopulateUARepeater.Dispose();
                ProgramFilesCon.Close();
                RepeaterEditOS.DataSource = ProgramFilesTable;
                RepeaterEditOS.DataBind();
            }
        }
        else
        {
            Response.Redirect("Login.aspx?status=NotLoggedIn");
        }
    }
Beispiel #3
0
        protected void RadioButtonListStatusOption_SelectedIndexChanged(object sender, EventArgs e)
        {
            SqlConnection  ProgramFilesCon     = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProgramFilesDB;Data Source=ACER-PC\\SQLEXPRESS");
            SqlDataAdapter ProgramFilesAdapter = new SqlDataAdapter();
            DataTable      ProgramFilesTable   = new DataTable();

            ProgramFilesCon.Open();

            string SelectedRBL = RadioButtonListStatusOption.SelectedItem.Text;
            string query       = "";

            switch (SelectedRBL)
            {
            case "All":
                query = "select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID";
                break;

            case "Awaiting Payment":
                query = "select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID AND OrderStatus='Awaiting Payment'";
                break;

            case "On Process":
                query = "select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID AND OrderStatus='On Process'";
                break;

            case "Completed":
                query = "select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID AND OrderStatus='Completed'";
                break;
            }


            SqlCommand UpdateOrdersList = new SqlCommand(query, ProgramFilesCon);

            ProgramFilesAdapter.SelectCommand = UpdateOrdersList;
            ProgramFilesAdapter.Fill(ProgramFilesTable);
            ProgramFilesAdapter.Dispose();
            UpdateOrdersList.Dispose();
            ProgramFilesCon.Close();
            RepeaterEditOS.DataSource = ProgramFilesTable;
            RepeaterEditOS.DataBind();


            ProgramFilesCon.Close();
        }