Создание веб-приложения, сочетающего в себе проектирование и создание баз данных, работу со сторонними форматами данных, программирование в NET и веб-разработку, страница 92

                dt.Clear();

                da = new MySqlDataAdapter(sql, conn);

                da.Fill(dt);

                report.DataSource = dt;

                report.DataBind();

                if (report.Rows.Count == 2)

                {

                    if (Convert.ToInt32(report.Rows[0].Cells[9].Text) == Convert.ToInt32(report.Rows[1].Cells[10].Text))

                    {

                        build_tab(out tab,report);

                    }

                    else

                    {

                        tab = "Warning";

                    }

                }

                else if (report.Rows.Count == 1)

                {

                    build_tab(out tab,report);

                }

                else

                {

                    tab = "";

                }

                return tab;

            }

            catch (MySqlException exp)

            {

                conn.Close();

                return null;

            }

        }

        public static void build_tab(out string tab, GridView report)

        {

            tab = "";

            if (report.Rows[0].Cells[1].Text.Equals(report.Rows[0].Cells[11].Text))

            {

                tab = report.Rows[0].Cells[9].Text + "-" + report.Rows[0].Cells[10].Text;

            }

            else if (report.Rows[0].Cells[1].Text.Equals(report.Rows[0].Cells[12].Text))

            {

                tab = report.Rows[0].Cells[10].Text + "-" + report.Rows[0].Cells[9].Text;

            }

            if (Convert.ToInt32(report.Rows[0].Cells[3].Text) == 1)

            {//победа

            }

            else if (Convert.ToInt32(report.Rows[0].Cells[4].Text) == 1)

            {

                tab += " ОТ";

            }

            else if (Convert.ToInt32(report.Rows[0].Cells[5].Text) == 1)

            {

                tab += " ШБ";

            }

            else if (Convert.ToInt32(report.Rows[0].Cells[6].Text) == 1)

            {

                tab += " ШБ";

            }

            else if (Convert.ToInt32(report.Rows[0].Cells[7].Text) == 1)

            {

                tab += " ОТ";

            }

            else if (Convert.ToInt32(report.Rows[0].Cells[8].Text) == 1)

            {//поражение

            }

        }

    }

}

Е.4 Файл powplay.Master.cs

namespace powerplay

{

    public partial class powplay : System.Web.UI.MasterPage

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            inity();

        }

        public void inity()

        {

            if (((Literal)this.LoginView_userinfo.FindControl("name_label")) != null)

            {

                ((Literal)(this.LoginView_userinfo.FindControl("name_label"))).Text = Page.User.Identity.Name.ToString();

                ((Literal)(this.LoginView_userinfo.FindControl("role_label"))).Text = "(" + ((RolePrincipal)Page.User).GetRoles()[0] + ")";

                MembershipUser user = Membership.GetUser();

                string []team = PowerPlayUserProvider.getTeamByUsername(Page.User.Identity.Name);

                if (team != null)

                {

                    ((Literal)(this.LoginView_userinfo.FindControl("team_label"))).Text = "КХЛ: " + team[0].ToString();

                }

                string avatar = PowerPlayUserProvider.getAvatar(Page.User.Identity.Name);

                if (avatar != null && avatar != "")

                {

                    ((Literal)(this.LoginView_userinfo.FindControl("avatar"))).Text = "<img id=\"avatar\" src=\"" + avatar + "\" height=\"80px\" />";

                }

                else

                {