Example #1
0
 protected void RejectOthers(string id)
 {
     foreach (GridViewRow row in GridViewGroupDetails.Rows)
     {
         if (row.Cells[0].Text != id)
         {
             int comid;
             int.TryParse(row.Cells[0].Text, out comid);
             Commissions.RejectComission(comid);
         }
     }
 }
Example #2
0
 protected void RejectOthers(string id)
 {
     foreach (GridViewRow row in GridViewGroupDetails.Rows)
     {
         if (row.Cells[0].Text != id)
         {
             int comid;
             int.TryParse(row.Cells[0].Text, out comid);
             if (Commissions.RejectComission(comid) == false)
             {
                 Response.Redirect("~/Error.aspx");
             }
         }
     }
 }
Example #3
0
        protected void Comissions_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "SubmitRating")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id, rating;
                GridViewRow row = HistoryOfComissions.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                int.TryParse(((HtmlInputGenericControl)row.FindControl("starating")).Value, out rating);
                if (Commissions.SetRating(id, rating) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("Comissions.aspx");
            }

            if (e.CommandName == "SetPrice")
            {
                int         Price_int;
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = PendingComissions.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                TextBox Price = row.FindControl("txtPrice") as TextBox;
                if (!int.TryParse(Price.Text, out Price_int))
                {
                    PriceServerValidator.IsValid = false;
                    ValSum.ValidationGroup       = "ComissionPrice";
                }
                else if (PriceServerValidator.IsValid == false)
                {
                    PriceServerValidator.IsValid = true;
                }

                if (Commissions.AddPrice(id, Price_int) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
            if (e.CommandName == "RejectComissionWorkshop")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = PendingComissions.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                if (Commissions.RejectComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
            if (e.CommandName == "ConcludeComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = ActiveComissions.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                LabelComissoesAtivas.Text = id.ToString();
                if (Commissions.ConcludeComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
            if (e.CommandName == "EditPrice")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = PendingComissions.Rows[index];
                TextBox     Price = row.FindControl("txtPrice") as TextBox;
                if (Price.Text == "N/A")
                {
                    Price.ReadOnly = false;
                    Price.Text     = "";
                    Button BtnSetPrice = row.FindControl("BtnSetPrice") as Button;
                    BtnSetPrice.Visible = false;
                    Button BtnAcceptComission = row.FindControl("BtnAcceptComission") as Button;
                    BtnAcceptComission.Visible = true;
                }
                else
                {
                    return;
                }
                return;
            }

            if (e.CommandName == "AcceptComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewGroupDetails.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                if (Commissions.ActivateComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                RejectOthers(row.Cells[0].Text);

                Response.Redirect("~/DualRole/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }

            if (e.CommandName == "RejectComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewGroupDetails.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                if (Commissions.RejectComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/DualRole/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }

            if (e.CommandName == "ShowGroupDetails")
            {
                int         index = Convert.ToInt32(e.CommandArgument), groupno;
                GridViewRow row = GridViewGroupComissions.Rows[index];
                int.TryParse(row.Cells[0].Text, out groupno);

                Populate_Details(groupno);
            }

            if (e.CommandName == "AcceptComissionNonGroup")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewComissionsPending.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                if (Commissions.ActivateComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/DualRole/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }
            if (e.CommandName == "RejectComissionNonGroup")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewComissionsPending.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                if (Commissions.RejectComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/DualRole/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }

            UpdateBadges();
            PopulateGridViews();
            GetRatings();
            GetPrices();
            EditTablesUpdatePanel.Update();
        }
Example #4
0
        protected void Comissions_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "SubmitRating")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id, rating;
                GridViewRow row = HistoryOfComissions.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                int.TryParse(((HtmlInputGenericControl)row.FindControl("starating")).Value, out rating);
                if (Commissions.SetRating(id, rating) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("Comissions.aspx");
            }

            if (e.CommandName == "SetPrice")
            {
                int         Price_int;
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = PendingComissions.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                TextBox Price = row.FindControl("txtPrice") as TextBox;
                if (!int.TryParse(Price.Text, out Price_int))
                {
                    PriceServerValidator.IsValid = false;
                    ValSum.ValidationGroup       = "ComissionPrice";
                }
                else if (PriceServerValidator.IsValid == false)
                {
                    PriceServerValidator.IsValid = true;
                }
                if (Commissions.AddPrice(id, Price_int) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
            if (e.CommandName == "RejectComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = PendingComissions.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                if (Commissions.RejectComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
            if (e.CommandName == "ConcludeComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = ActiveComissions.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                LabelComissoesAtivas.Text = id.ToString();
                if (Commissions.ConcludeComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
            if (e.CommandName == "EditPrice")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = PendingComissions.Rows[index];
                TextBox     Price = row.FindControl("txtPrice") as TextBox;
                if (Price.Text == "N/A")
                {
                    Price.ReadOnly = false;
                    Price.Text     = "";
                    Button BtnSetPrice = row.FindControl("BtnSetPrice") as Button;
                    BtnSetPrice.Visible = false;
                    Button BtnAcceptComission = row.FindControl("BtnAcceptComission") as Button;
                    BtnAcceptComission.Visible = true;
                }
                else
                {
                    return;
                }
                return;
            }

            UpdateBadges();
            PopulateGridViews();
            GetRatings();
            GetPrices();
        }
Example #5
0
        protected void Comissions_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "SubmitRating")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id, rating;
                GridViewRow row = HistoryOfComissions.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                int.TryParse(((HtmlInputGenericControl)row.FindControl("starating")).Value, out rating);
                if (Commissions.SetRating(id, rating) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/Account/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }

            if (e.CommandName == "AcceptComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewGroupDetails.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                if (Commissions.ActivateComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                RejectOthers(row.Cells[0].Text);

                Response.Redirect("~/Account/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }

            if (e.CommandName == "RejectComission")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewGroupDetails.Rows[index];
                int.TryParse(row.Cells[0].Text, out id);
                if (Commissions.RejectComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/Account/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }

            if (e.CommandName == "ShowGroupDetails")
            {
                int         index = Convert.ToInt32(e.CommandArgument), groupno;
                GridViewRow row = GridViewGroupComissions.Rows[index];
                int.TryParse(row.Cells[0].Text, out groupno);

                Populate_Details(groupno);
            }
            if (e.CommandName == "AcceptComissionNonGroup")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewComissionsPending.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                if (Commissions.ActivateComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/Account/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }
            if (e.CommandName == "RejectComissionNonGroup")
            {
                int         index = Convert.ToInt32(e.CommandArgument), id;
                GridViewRow row = GridViewComissionsPending.Rows[index];
                int.TryParse(row.Cells[1].Text, out id);
                if (Commissions.RejectComission(id) == false)
                {
                    Response.Redirect("~/Error.aspx");
                }

                Response.Redirect("~/Account/Comissions.aspx");//Errado, mas se não for feito, as avaliações não são carregadas. (erro desconhecido)
            }


            PopulateGridViews();
            GetRatings();
            GetPrices();
            UpdateBadges();
        }