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("Name", typeof(string))); dataTable.Columns.Add(new DataColumn("CompetitionName", typeof(string))); List <zApplicationTable> applicationList = (from a in competitionDataBase.zApplicationTable where a.Active == true && a.Sended == true join b in competitionDataBase.zCompetitionsTable on a.FK_CompetitionTable equals b.ID where b.Active == true join c in competitionDataBase.zExpertsAndApplicationMappingTable on a.ID equals c.FK_ApplicationsTable where c.Active == true && c.FK_UsersTable == userId select a).Distinct().ToList(); List <zApplicationTable> notreadyapp = new List <zApplicationTable>(); foreach (zApplicationTable current in applicationList) { List <zExpertPointsValue> notsended = (from a in competitionDataBase.zExpertPointsValue where a.Active == true && a.Sended == false && a.FK_ApplicationTable == current.ID && a.FK_ExpertsTable == userId select a).ToList(); if (notsended.Count == 6) { notreadyapp.Add(current); } } foreach (zApplicationTable currentApplication in notreadyapp) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["CompetitionName"] = (from a in competitionDataBase.zCompetitionsTable where a.ID == (Convert.ToInt32(currentApplication.FK_CompetitionTable)) select a.Name).FirstOrDefault(); dataTable.Rows.Add(dataRow); } ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // XmlCreate xmlCreate = new XmlCreate(); /* TextBox1.Text = xmlCreate.StartTable() + * xmlCreate.StartRow() + * xmlCreate.StartCell() + * "123" + * xmlCreate.EndCell() + * xmlCreate.EndRow() + * xmlCreate.EndTable(); */ 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("Name", typeof(string))); dataTable.Columns.Add(new DataColumn("CompetitionName", typeof(string))); List <zApplicationTable> applicationList = (from a in competitionDataBase.zApplicationTable where a.FK_UsersTable == userId && a.Active == true && a.Sended == false join b in competitionDataBase.zCompetitionsTables on a.FK_CompetitionTable equals b.ID where b.Active == true && b.OpenForApplications == true select a).Distinct().ToList(); foreach (zApplicationTable currentApplication in applicationList) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["CompetitionName"] = (from a in competitionDataBase.zCompetitionsTables where a.ID == (Convert.ToInt32(currentApplication.FK_CompetitionTable)) select a.Name).FirstOrDefault(); dataTable.Rows.Add(dataRow); } /*DataSet newDataSet = new DataSet(); * newDataSet.Tables.Add(dataTable); * string filePath = @"C:\1\1112.xml"; * newDataSet.WriteXml(filePath); */ ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); List <zApplicationTable> applicationsList = (from a in CompetitionsDataBase.zApplicationTable where a.Active == true && a.Accept == false join b in CompetitionsDataBase.zCompetitionsTable on a.FK_CompetitionTable equals b.ID where b.Active == true select a).ToList(); if (applicationsList != null) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("ID", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Email", typeof(string)); dataTable.Columns.Add("Autor", typeof(string)); dataTable.Columns.Add("Competition", typeof(string)); dataTable.Columns.Add("SendedDataTime", typeof(string)); foreach (zApplicationTable currentApplication in applicationsList) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["Email"] = (from a in CompetitionsDataBase.UsersTable where a.ID == currentApplication.FK_UsersTable select a.Email).FirstOrDefault(); if (currentApplication.Sended == false) { dataRow["SendedDataTime"] = "Заявка в процессе заполнения"; } else { dataRow["SendedDataTime"] = currentApplication.SendedDataTime.ToString().Split(' ')[0]; } dataRow["Competition"] = (from a in CompetitionsDataBase.zCompetitionsTable where a.ID == currentApplication.FK_CompetitionTable select a.Name).FirstOrDefault(); dataTable.Rows.Add(dataRow); } ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } } else { Label1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); List <zApplicationTable> applicationsList = (from a in CompetitionsDataBase.zApplicationTable where a.Active == true && a.Accept == true select a).ToList(); DataTable dataTable = new DataTable(); dataTable.Columns.Add("ID", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Description", typeof(string)); dataTable.Columns.Add("Autor", typeof(string)); dataTable.Columns.Add("Competition", typeof(string)); dataTable.Columns.Add("Experts", typeof(string)); dataTable.Columns.Add("SendedDataTime", typeof(string)); foreach (zApplicationTable currentApplication in applicationsList) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["Description"] = ""; dataRow["SendedDataTime"] = currentApplication.SendedDataTime.ToString().Split(' ')[0];; dataRow["Competition"] = (from a in CompetitionsDataBase.zCompetitionsTable where a.ID == currentApplication.FK_CompetitionTable select a.Name).FirstOrDefault(); dataRow["Autor"] = (from a in CompetitionsDataBase.UsersTable where a.ID == currentApplication.FK_UsersTable select a.Email).FirstOrDefault(); List <UsersTable> expertsList = (from a in CompetitionsDataBase.UsersTable join b in CompetitionsDataBase.zExpertsAndApplicationMappingTable on a.ID equals b.FK_UsersTable where a.AccessLevel == 5 && a.Active == true && b.FK_ApplicationsTable == currentApplication.ID && b.Active == true select a).ToList(); string expertNamesList = ""; foreach (UsersTable currentExpert in expertsList) { expertNamesList += currentExpert.Email + " \n"; } dataRow["Experts"] = expertNamesList; dataTable.Rows.Add(dataRow); } ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } }
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("Name", typeof(string))); dataTable.Columns.Add(new DataColumn("CompetitionName", typeof(string))); List <zApplicationTable> applicationList = (from a in competitionDataBase.zApplicationTable where a.FK_UsersTable == userId && a.Active == true && a.Sended == true join b in competitionDataBase.zCompetitionsTables on a.FK_CompetitionTable equals b.ID where b.Active == true && b.OpenForApplications == true select a).Distinct().ToList(); foreach (zApplicationTable currentApplication in applicationList) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["CompetitionName"] = (from a in competitionDataBase.zCompetitionsTables where a.ID == (Convert.ToInt32(currentApplication.FK_CompetitionTable)) select a.Name).FirstOrDefault(); dataTable.Rows.Add(dataRow); } ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } }
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 CompetitionsDataBase = new CompetitionDataContext(); List <zCompetitionsTable> competitionsList = (from a in CompetitionsDataBase.zCompetitionsTable where a.Active == true && a.FK_Curator == userId select a).ToList(); foreach (zCompetitionsTable current in competitionsList) { List <zApplicationTable> applicationsList = (from a in CompetitionsDataBase.zApplicationTable where a.Active == true && a.Sended == true && a.FK_CompetitionTable == current.ID select a).ToList(); System.Data.DataTable dataTable = new System.Data.DataTable(); dataTable.Columns.Add("ID", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Competition", typeof(string)); dataTable.Columns.Add("Experts", typeof(string)); dataTable.Columns.Add("Email", typeof(string)); dataTable.Columns.Add("Accept", typeof(string)); dataTable.Columns.Add("SendedDataTime", typeof(string)); foreach (zApplicationTable currentApplication in applicationsList) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["SendedDataTime"] = currentApplication.SendedDataTime.ToString().Split(' ')[0]; dataRow["Competition"] = (from a in CompetitionsDataBase.zCompetitionsTable where a.ID == currentApplication.FK_CompetitionTable select a.Name).FirstOrDefault(); dataRow["Email"] = (from a in CompetitionsDataBase.UsersTable where a.ID == currentApplication.FK_UsersTable select a.Email).FirstOrDefault(); zApplicationTable status = (from a in CompetitionsDataBase.zApplicationTable where a.ID == currentApplication.ID select a).FirstOrDefault(); if (status.Accept == true) { dataRow["Accept"] = "Принята"; } else { dataRow["Accept"] = "На рассмотрении"; } List <UsersTable> expertsList = (from a in CompetitionsDataBase.UsersTable join b in CompetitionsDataBase.zExpertsAndApplicationMappingTable on a.ID equals b.FK_UsersTable where a.AccessLevel == 5 && a.Active == true && b.FK_ApplicationsTable == currentApplication.ID && b.Active == true select a).ToList(); string expertNamesList = ""; foreach (UsersTable currentExpert in expertsList) { expertNamesList += currentExpert.Email + " \n"; } dataRow["Experts"] = expertNamesList; dataTable.Rows.Add(dataRow); } ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var userIdtmp = Session["UserID"]; if (userIdtmp == null) { Response.Redirect("~/Default.aspx"); } int userId = (int)userIdtmp; CompetitionDataContext competitionDataBase = new CompetitionDataContext(); CompetitionCountDown competitionCountDown = new CompetitionCountDown(); Tab1.CssClass = "Clicked"; MainView.ActiveViewIndex = 0; #region competitions { 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))); List <zCompetitionsTable> competitionsList = (from a in competitionDataBase.zCompetitionsTable where a.Active == true && a.OpenForApplications == true select a).ToList(); foreach (zCompetitionsTable currentCompetition in competitionsList) { if (competitionCountDown.IsCompetitionEndDateExpired(currentCompetition.ID)) { continue; } 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]; dataTable.Rows.Add(dataRow); } MainGV.DataSource = dataTable; MainGV.DataBind(); } #endregion /// в первую таблицу все те у которых конкурс еще открыт а заявка не отправлена /// во вторую все те у которых заявка отправлена /// в третью все те у которых закрыта заявка #region currentApplications { 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("CompetitionName", typeof(string))); dataTable.Columns.Add(new DataColumn("StatusLabelEnabled", typeof(bool))); dataTable.Columns.Add(new DataColumn("SendButtonEnabled", typeof(bool))); List <zApplicationTable> applicationList = (from a in competitionDataBase.zApplicationTable where a.FK_UsersTable == userId && a.Sended == false && a.Active == true join b in competitionDataBase.zCompetitionsTable on a.FK_CompetitionTable equals b.ID where b.Active == true && b.OpenForApplications == true select a).Distinct().ToList(); Status status = new Status(); foreach (zApplicationTable currentApplication in applicationList) { if (competitionCountDown.IsCompetitionEndDateExpiredByApplication(currentApplication.ID)) { continue; } DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["CompetitionName"] = (from a in competitionDataBase.zCompetitionsTable where a.ID == (Convert.ToInt32(currentApplication.FK_CompetitionTable)) select a.Name).FirstOrDefault(); if (status.IsApplicationReadyToSend(currentApplication.ID)) { dataRow["StatusLabelEnabled"] = false; dataRow["SendButtonEnabled"] = true; } else { dataRow["StatusLabelEnabled"] = true; dataRow["SendButtonEnabled"] = false; } dataTable.Rows.Add(dataRow); } ApplicationGV.DataSource = dataTable; ApplicationGV.DataBind(); } #endregion #region applicationsArchive { 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("CompetitionName", typeof(string))); dataTable.Columns.Add(new DataColumn("SendedDate", typeof(string))); dataTable.Columns.Add(new DataColumn("Accept", typeof(string))); List <zApplicationTable> applicationList = (from a in competitionDataBase.zApplicationTable where a.FK_UsersTable == userId && a.Active == true && a.Sended == true join b in competitionDataBase.zCompetitionsTable on a.FK_CompetitionTable equals b.ID where b.Active == true select a).Distinct().ToList(); foreach (zApplicationTable currentApplication in applicationList) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["CompetitionName"] = (from a in competitionDataBase.zCompetitionsTable where a.ID == (Convert.ToInt32(currentApplication.FK_CompetitionTable)) select a.Name).FirstOrDefault(); if (currentApplication.SendedDataTime == null) { dataRow["SendedDate"] = "Не отправлялось на рассмотрение"; } else { dataRow["SendedDate"] = currentApplication.SendedDataTime.ToString().Split(' ')[0]; } zApplicationTable accept = (from a in competitionDataBase.zApplicationTable where a.ID == (Convert.ToInt32(currentApplication.ID)) select a).FirstOrDefault(); if (accept.Accept == true) { dataRow["Accept"] = "Принята"; } else { dataRow["Accept"] = "На рассмотрении"; } dataTable.Rows.Add(dataRow); } ArchiveApplicationGV.DataSource = dataTable; ArchiveApplicationGV.DataBind(); } #endregion #region draftApplications { 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("CompetitionName", typeof(string))); List <zApplicationTable> applicationList = (from a in competitionDataBase.zApplicationTable where a.FK_UsersTable == userId && a.Active == true join b in competitionDataBase.zCompetitionsTable on a.FK_CompetitionTable equals b.ID where b.Active == true select a).Distinct().ToList(); foreach (zApplicationTable currentApplication in applicationList) { if (competitionIsClosed(currentApplication) || competitionCountDown.IsCompetitionEndDateExpiredByApplication(currentApplication.ID)) { DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentApplication.ID; dataRow["Name"] = currentApplication.Name; dataRow["CompetitionName"] = (from a in competitionDataBase.zCompetitionsTable where a.ID == (Convert.ToInt32(currentApplication.FK_CompetitionTable)) select a.Name).FirstOrDefault(); dataTable.Rows.Add(dataRow); } } DraftGridView.DataSource = dataTable; DraftGridView.DataBind(); } #endregion } }