Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var userIdtmp = Session["UserID"];

            if (userIdtmp == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            int userId = (int)userIdtmp;

            if (!Page.IsPostBack)
            {
                CompetitionDataContext competitionDataBase = new CompetitionDataContext();

                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Number", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Budjet", typeof(string)));
                dataTable.Columns.Add(new DataColumn("StartDate", typeof(string)));
                dataTable.Columns.Add(new DataColumn("EndDate", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Sended", typeof(string)));

                List <zCompetitionsTable> competitionsList = (from a in competitionDataBase.zCompetitionsTable
                                                              where a.Active == true && a.FK_Curator == userId
                                                              select a).ToList();

                foreach (zCompetitionsTable currentCompetition in competitionsList)
                {
                    DataRow dataRow = dataTable.NewRow();
                    dataRow["ID"]        = currentCompetition.ID;
                    dataRow["Name"]      = currentCompetition.Name;
                    dataRow["Number"]    = currentCompetition.Number;
                    dataRow["Budjet"]    = Convert.ToInt32(currentCompetition.Budjet);
                    dataRow["StartDate"] = currentCompetition.StartDate.ToString().Split(' ')[0];
                    dataRow["EndDate"]   = currentCompetition.EndDate.ToString().Split(' ')[0];
                    if (currentCompetition.Sended == false)
                    {
                        dataRow["Sended"] = "На рассмотрении";
                    }
                    else
                    {
                        dataRow["Sended"] = "Открыт для подачи заявок";
                    }

                    dataTable.Rows.Add(dataRow);
                }
                CompetitionsGV.DataSource = dataTable;
                CompetitionsGV.DataBind();
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CompetitionDataContext competitionDataBase = new CompetitionDataContext();

                DataTable dataTable = new DataTable();
                dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Number", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Status", typeof(string)));

                List <zCompetitionsTable> competitionsList = (from a in competitionDataBase.zCompetitionsTable
                                                              where a.Active == true
                                                              select a).ToList();

                foreach (zCompetitionsTable currentCompetition in competitionsList)
                {
                    DataRow dataRow = dataTable.NewRow();
                    dataRow["ID"]     = currentCompetition.ID;
                    dataRow["Name"]   = currentCompetition.Name;
                    dataRow["Number"] = currentCompetition.Number;
                    if ((bool)currentCompetition.OpenForApplications)
                    {
                        dataRow["Status"] = "Открыт";
                    }
                    else
                    {
                        dataRow["Status"] = "Закрыт";
                    }

                    dataTable.Rows.Add(dataRow);
                }
                CompetitionsGV.DataSource = dataTable;
                CompetitionsGV.DataBind();
            }
        }