protected void GetPrices() { foreach (GridViewRow row in PendingComissions.Rows) { int id, price; int.TryParse(row.Cells[1].Text, out id); price = Commissions.GetPrice(id); TextBox txtPrice = row.FindControl("txtPrice") as TextBox; Button BtnOrcamento = row.FindControl("BtnSetPrice") as Button; Button BtnReject = row.FindControl("BtnRejectComission") as Button; if (price != 0) { BtnOrcamento.Visible = false; BtnReject.Visible = false; txtPrice.Text = price.ToString(); } else { txtPrice.ReadOnly = false; txtPrice.Text = "N/A"; txtPrice.ReadOnly = true; } } }
protected void Populate_Details(int groupno) { string storedprocedure = "GetComissionDetails"; 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", groupno); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); GridViewGroupDetails.DataSource = dt; GridViewGroupDetails.DataBind(); cn.Close(); GridViewGroupDetails.Visible = true; foreach (GridViewRow row in GridViewGroupDetails.Rows) { int id, price; int.TryParse(row.Cells[0].Text, out id); price = Commissions.GetPrice(id); Label LabelPrice = row.FindControl("LabelPrice") as Label; if (price != 0) { LabelPrice.Text = price.ToString(); } else { Button BtnAcceptComission = row.FindControl("BtnAcceptComission") as Button; Button BtnRejectComission = row.FindControl("BtnRejectComission") as Button; BtnAcceptComission.Visible = false; BtnRejectComission.Visible = false; LabelPrice.Text = "N/A"; } } }
protected void GetPrices() { foreach (GridViewRow row in GridViewComissionsPending.Rows) { int id, price; int.TryParse(row.Cells[1].Text, out id); price = Commissions.GetPrice(id); Label LabelPrice = row.FindControl("LabelPrice") as Label; if (price != 0) { LabelPrice.Text = price.ToString(); } else { Button BtnAcceptComission = row.FindControl("BtnAcceptComission") as Button; Button BtnRejectComission = row.FindControl("BtnRejectComission") as Button; BtnAcceptComission.Visible = false; BtnRejectComission.Visible = false; LabelPrice.Text = "N/A"; } } }