Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         GridViewActiveComissions.DataBind();
         GridViewComissionsPending.DataBind();
         HistoryOfComissions.DataBind();
         ActiveComissions.DataBind();
         PendingComissions.DataBind();
         HistoryOfComissions.DataBind();
         Clientes.DataBind();
         GetRatings();
         GetPrices();
         UpdateBadges();
     }
 }
Exemple #2
0
        protected void PopulateGridViews()
        {
            //-----Client------//

            ApplicationDbContext context = new ApplicationDbContext();
            var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context));
            var user        = UserManager.FindById(User.Identity.GetUserId());

            //Active
            string        storedprocedure = "GetActiveComissions";
            SqlConnection cn = GetSqlCon.GetCon();

            if (cn == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt  = new DataTable();
            SqlCommand cmd = new SqlCommand(storedprocedure, cn);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            GridViewActiveComissions.DataSource = dt;
            GridViewActiveComissions.DataBind();
            cn.Close();

            //Pending - Singles
            string        storedprocedure2 = "GetPendingComissions";
            SqlConnection cn2 = GetSqlCon.GetCon();

            if (cn2 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt2  = new DataTable();
            SqlCommand cmd2 = new SqlCommand(storedprocedure2, cn2);

            cmd2.CommandType = System.Data.CommandType.StoredProcedure;
            cmd2.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da2 = new SqlDataAdapter(cmd2);

            da2.Fill(dt2);
            GridViewComissionsPending.DataSource = dt2;
            GridViewComissionsPending.DataBind();
            cn2.Close();

            //Pending - Group
            string        storedprocedure8 = "GetPendingGroupComissions";
            SqlConnection cn8 = GetSqlCon.GetCon();

            if (cn8 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt8  = new DataTable();
            SqlCommand cmd8 = new SqlCommand(storedprocedure8, cn8);

            cmd8.CommandType = System.Data.CommandType.StoredProcedure;
            cmd8.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da8 = new SqlDataAdapter(cmd8);

            da8.Fill(dt8);
            GridViewGroupComissions.DataSource = dt8;
            GridViewGroupComissions.DataBind();
            cn8.Close();

            //History
            string        storedprocedure3 = "HistoryOfcomissions";
            SqlConnection cn3 = GetSqlCon.GetCon();

            if (cn3 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt3  = new DataTable();
            SqlCommand cmd3 = new SqlCommand(storedprocedure3, cn3);

            cmd3.CommandType = System.Data.CommandType.StoredProcedure;
            cmd3.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da3 = new SqlDataAdapter(cmd3);

            da3.Fill(dt3);
            HistoryOfComissions.DataSource = dt3;
            HistoryOfComissions.DataBind();
            cn3.Close();


            //-----Workshop-----//

            //Active
            string        storedprocedure4 = "GetActiveComissionsWorkshop";
            SqlConnection cn4 = GetSqlCon.GetCon();

            if (cn4 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt4  = new DataTable();
            SqlCommand cmd4 = new SqlCommand(storedprocedure4, cn4);

            cmd4.CommandType = System.Data.CommandType.StoredProcedure;
            cmd4.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da4 = new SqlDataAdapter(cmd4);

            da4.Fill(dt4);
            ActiveComissions.DataSource = dt4;
            ActiveComissions.DataBind();

            //Pending
            string        storedprocedure5 = "GetPendingComissionsWorkshop";
            SqlConnection cn5 = GetSqlCon.GetCon();

            if (cn5 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt5  = new DataTable();
            SqlCommand cmd5 = new SqlCommand(storedprocedure5, cn5);

            cmd5.CommandType = System.Data.CommandType.StoredProcedure;
            cmd5.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da5 = new SqlDataAdapter(cmd5);

            da5.Fill(dt5);
            PendingComissions.DataSource = dt5;
            PendingComissions.DataBind();

            //History
            string        storedprocedure6 = "GetHistoryOfComissionsWorkshop";
            SqlConnection cn6 = GetSqlCon.GetCon();

            if (cn6 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt6  = new DataTable();
            SqlCommand cmd6 = new SqlCommand(storedprocedure6, cn6);

            cmd6.CommandType = System.Data.CommandType.StoredProcedure;
            cmd6.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da6 = new SqlDataAdapter(cmd6);

            da6.Fill(dt6);
            HistoryOfComissionsWorkshop.DataSource = dt6;
            HistoryOfComissionsWorkshop.DataBind();

            //Clients
            string        storedprocedure7 = "GetWorkshopClients";
            SqlConnection cn7 = GetSqlCon.GetCon();

            if (cn7 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt7  = new DataTable();
            SqlCommand cmd7 = new SqlCommand(storedprocedure7, cn7);

            cmd7.CommandType = System.Data.CommandType.StoredProcedure;
            cmd7.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da7 = new SqlDataAdapter(cmd7);

            da7.Fill(dt7);
            Clientes.DataSource = dt7;
            Clientes.DataBind();
        }
Exemple #3
0
        protected void PopulateGridViews()
        {
            ApplicationDbContext context = new ApplicationDbContext();
            var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context));
            var user        = UserManager.FindById(User.Identity.GetUserId());

            //Active
            string        storedprocedure = "GetActiveComissionsWorkshop";
            SqlConnection cn = GetSqlCon.GetCon();

            if (cn == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt  = new DataTable();
            SqlCommand cmd = new SqlCommand(storedprocedure, cn);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            ActiveComissions.DataSource = dt;
            ActiveComissions.DataBind();

            //Pending
            string        storedprocedure2 = "GetPendingComissionsWorkshop";
            SqlConnection cn2 = GetSqlCon.GetCon();

            if (cn2 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt2  = new DataTable();
            SqlCommand cmd2 = new SqlCommand(storedprocedure2, cn2);

            cmd2.CommandType = System.Data.CommandType.StoredProcedure;
            cmd2.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da2 = new SqlDataAdapter(cmd2);

            da2.Fill(dt2);
            PendingComissions.DataSource = dt2;
            PendingComissions.DataBind();

            //History
            string        storedprocedure3 = "GetHistoryOfComissionsWorkshop";
            SqlConnection cn3 = GetSqlCon.GetCon();

            if (cn3 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt3  = new DataTable();
            SqlCommand cmd3 = new SqlCommand(storedprocedure3, cn3);

            cmd3.CommandType = System.Data.CommandType.StoredProcedure;
            cmd3.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da3 = new SqlDataAdapter(cmd3);

            da3.Fill(dt3);
            HistoryOfComissions.DataSource = dt3;
            HistoryOfComissions.DataBind();

            //Clients
            string        storedprocedure4 = "GetWorkshopClients";
            SqlConnection cn4 = GetSqlCon.GetCon();

            if (cn4 == null)
            {
                Response.Redirect("~/Error.aspx");
            }

            DataTable  dt4  = new DataTable();
            SqlCommand cmd4 = new SqlCommand(storedprocedure4, cn4);

            cmd4.CommandType = System.Data.CommandType.StoredProcedure;
            cmd4.Parameters.AddWithValue("@param1", user.Id);
            SqlDataAdapter da4 = new SqlDataAdapter(cmd4);

            da4.Fill(dt4);
            Clientes.DataSource = dt4;
            Clientes.DataBind();
        }