Exemplo n.º 1
0
        protected void LoadGroupDetails()
        {
            string        connStr = System.Configuration.ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
            SqlConnection conn    = new SqlConnection(connStr);
            string        sql     = "select * from Groups where TeacherID='" + Session["TeacherId"].ToString() + "'";
            //sql = "Select * from StudentInformation where TeacherId='"+Session["TeacherId"].ToString()+"'";
            SqlDataAdapter    AdapterGroupInformation = new SqlDataAdapter(sql, conn);
            SqlCommandBuilder builder = new SqlCommandBuilder(AdapterGroupInformation);
            DataSet           ds      = new DataSet();

            AdapterGroupInformation.Fill(ds, "GroupInformation");

            GridViewGroupDetails.DataSource = ds.Tables["GroupInformation"];
            GridViewGroupDetails.DataBind();
        }
Exemplo n.º 2
0
        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";
                }
            }
        }