void DeleteRowButtonClick(object sender, EventArgs e) { ImageButton button = (ImageButton)sender; { SaveChanges(); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); var userIdParam = Session["UserID"]; int userId = Convert.ToInt32(userIdParam); var applicationId = Session["ApplicationID"]; int appid = Convert.ToInt32(applicationId); int partnerid = Convert.ToInt32(button.CommandArgument); zPartnersTable currentPartner = (from a in competitionDataBase.zPartnersTable where a.Active == true && a.ID == partnerid join b in competitionDataBase.zApplicationAndPartnersMappingTable on a.ID equals b.FK_PartnersTable where b.Active == true && b.FK_Application == appid select a).FirstOrDefault(); currentPartner.Active = false; competitionDataBase.SubmitChanges(); zApplicationAndPartnersMappingTable currentLink = (from a in competitionDataBase.zApplicationAndPartnersMappingTable where a.Active == true && a.FK_PartnersTable == partnerid && a.FK_Application == appid select a).FirstOrDefault(); currentLink.Active = false; competitionDataBase.SubmitChanges(); Response.Redirect("ChooseApplicationAction.aspx"); } }
protected void DeleteButtonClick(object sender, EventArgs e) { Button button = (Button)sender; { int iD = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zConstantListTable constantListToDelete = (from a in competitionDataBase.zConstantListTable where a.ID == iD select a).FirstOrDefault(); List <zCollectedDataTable> constatvalue = (from a in competitionDataBase.zCollectedDataTable where a.Active && a.FK_ConstantListTable == constantListToDelete.ID select a).ToList(); if (constantListToDelete != null) { constantListToDelete.Active = false; competitionDataBase.SubmitChanges(); foreach (zCollectedDataTable n in constatvalue) { n.Active = false; competitionDataBase.SubmitChanges(); } } else { //error } } Response.Redirect("ChooseConstantList.aspx"); }
protected void ExpertAddButtonClick(object sender, EventArgs e) { Button button = (Button)sender; if (button != null) { var appIdTmp = Session["ApplicationID"]; if (appIdTmp == null) { Response.Redirect("ApllicationExpertEdit.aspx"); } int applicationId = Convert.ToInt32(appIdTmp); CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); zExpertsAndApplicationMappingTable expertAndApplicationConnection = (from a in CompetitionsDataBase.zExpertsAndApplicationMappingTable where a.FK_UsersTable == Convert.ToInt32(button.CommandArgument) && a.FK_ApplicationsTable == applicationId select a).FirstOrDefault(); if (expertAndApplicationConnection != null) { expertAndApplicationConnection.Active = true; CompetitionsDataBase.SubmitChanges(); } else { expertAndApplicationConnection = new zExpertsAndApplicationMappingTable(); expertAndApplicationConnection.Active = true; expertAndApplicationConnection.FK_ApplicationsTable = applicationId; expertAndApplicationConnection.FK_UsersTable = Convert.ToInt32(button.CommandArgument); CompetitionsDataBase.zExpertsAndApplicationMappingTable.InsertOnSubmit(expertAndApplicationConnection); CompetitionsDataBase.SubmitChanges(); } } Response.Redirect("ApllicationExpertEdit.aspx"); }
protected void CreateSaveButtonClick(object sender, EventArgs e) { var userIdtmp = Session["UserID"]; if (userIdtmp == null) { Response.Redirect("~/CuratorMainPage.aspx"); } int userId = (int)userIdtmp; CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zCompetitionsTable newCompetition = new zCompetitionsTable(); newCompetition.Name = NameTextBox.Text; newCompetition.Budjet = Convert.ToDouble(BudjetTextBox.Text); newCompetition.FK_Curator = userId; newCompetition.StartDate = Calendar1.SelectedDate; newCompetition.EndDate = Calendar2.SelectedDate; newCompetition.Active = true; newCompetition.OpenForApplications = false; competitionDataBase.zCompetitionsTable.InsertOnSubmit(newCompetition); competitionDataBase.SubmitChanges(); foreach (ListItem current in CheckBoxList1.Items) { zActionsCompetitionsMappingTable actionlink = new zActionsCompetitionsMappingTable(); actionlink.FK_Competiton = newCompetition.ID; actionlink.FK_ActionPR = Convert.ToInt32(current.Value); actionlink.Active = current.Selected; competitionDataBase.zActionsCompetitionsMappingTable.InsertOnSubmit(actionlink); competitionDataBase.SubmitChanges(); } Session["CompetitionID"] = newCompetition.ID; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Готово!');", true); }
protected void AddRowButton_Click(object sender, EventArgs e) { SaveChanges(); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); var userIdParam = Session["UserID"]; int userId = Convert.ToInt32(userIdParam); var applicationId = Session["ApplicationID"]; int appid = Convert.ToInt32(applicationId); zPartnersTable newPartner = new zPartnersTable(); newPartner.Active = true; newPartner.Role = false; competitionDataBase.zPartnersTable.InsertOnSubmit(newPartner); competitionDataBase.SubmitChanges(); zApplicationAndPartnersMappingTable newLink = new zApplicationAndPartnersMappingTable(); newLink.Active = true; newLink.FK_Application = appid; newLink.FK_PartnersTable = newPartner.ID; competitionDataBase.zApplicationAndPartnersMappingTable.InsertOnSubmit(newLink); competitionDataBase.SubmitChanges(); Response.Redirect("ChooseApplicationAction.aspx"); }
protected void CreateSaveButtonClick(object sender, EventArgs e) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); var sessionParam1 = Session["CompetitionID"]; var sessionParam2 = Session["SectionID"]; if ((sessionParam1 == null) || (sessionParam2 == null)) { //error Response.Redirect("ChooseSection.aspx"); } else { int competitionId = (int)sessionParam1; int sectionId = (int)sessionParam2; if (sectionId > 0) { if ((NameTextBox.Text.Length > 0) && (DescriptionTextBox.Text.Length > 0)) { zSectionTable currentSection = (from a in competitionDataBase.zSectionTable where a.Active == true && a.ID == sectionId && a.FK_CompetitionsTable == competitionId select a).FirstOrDefault(); if (currentSection == null) { //error Response.Redirect("ChooseSection.aspx"); } else { currentSection.Name = NameTextBox.Text; currentSection.Description = DescriptionTextBox.Text; currentSection.FK_BlockID = Convert.ToInt32(DropDownList1.SelectedIndex); currentSection.ColumnMaxCount = Convert.ToInt32(MaxRowCountTextBox.Text); competitionDataBase.SubmitChanges(); } } } else { if ((NameTextBox.Text.Length > 0) && (DescriptionTextBox.Text.Length > 0)) { zSectionTable newSection = new zSectionTable(); newSection.Name = NameTextBox.Text; newSection.Description = DescriptionTextBox.Text; newSection.FK_BlockID = Convert.ToInt32(DropDownList1.SelectedIndex); newSection.ColumnMaxCount = Convert.ToInt32(MaxRowCountTextBox.Text); newSection.Active = true; newSection.FK_CompetitionsTable = competitionId; competitionDataBase.zSectionTable.InsertOnSubmit(newSection); competitionDataBase.SubmitChanges(); } } } Response.Redirect("ChooseSection.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { var sessionParam1 = Session["ApplicationID"]; var sessionParam2 = Session["UserID"]; if ((sessionParam1 == null) || (sessionParam2 == null)) { //error Response.Redirect("~/Default.aspx"); } int applicationId = Convert.ToInt32(sessionParam1); int userId = Convert.ToInt32(sessionParam2); CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); foreach (GridViewRow dataRow in EvaluateGV.Rows) { Label labelID = (Label)dataRow.FindControl("ID"); TextBox valueTextBox = (TextBox)dataRow.FindControl("ValueTextBox"); if (labelID != null) { zExpertPointsValue currentExpertPointValue = (from a in CompetitionsDataBase.zExpertPointsValue where a.ID == Convert.ToInt32(labelID.Text) select a).FirstOrDefault(); if (currentExpertPointValue != null) { if (valueTextBox.Text.Any()) { currentExpertPointValue.Value = valueTextBox.Text; } currentExpertPointValue.LastChangeDataTime = DateTime.Now; CompetitionsDataBase.SubmitChanges(); } } } #region doComment var commentIdTemp = ViewState["CommentID"]; if (commentIdTemp != null) { int commentId = (int)commentIdTemp; zExpertPointsValue commentExpertPointValue = (from a in CompetitionsDataBase.zExpertPointsValue where a.ID == commentId select a).FirstOrDefault(); if (commentExpertPointValue != null) { if (CommentTextBox.Text.Any()) { commentExpertPointValue.Value = CommentTextBox.Text; } commentExpertPointValue.LastChangeDataTime = DateTime.Now; CompetitionsDataBase.SubmitChanges(); } } #endregion }
protected void AddExpertGroupClick(object sender, EventArgs e) { var sessionParam1 = Session["ApplicationID"]; ImageButton button = (ImageButton)sender; if (sessionParam1 == null && button != null) { //error Response.Redirect("~/Default.aspx"); } int applicationId = Convert.ToInt32(sessionParam1); int groupId = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zApplicationTable currentApplication = (from a in competitionDataBase.zApplicationTable where a.Active == true && a.Accept == false && a.ID == applicationId && a.Sended == true select a).FirstOrDefault(); if (currentApplication != null) { List <zExpertAndExpertGroupMappingTable> currentgroup = (from a in competitionDataBase.zExpertAndExpertGroupMappingTable where a.Active == true && a.FK_ExpertGroupTable == groupId select a).ToList(); if (currentgroup != null) { foreach (var n in currentgroup) { zExpertsAndApplicationMappingTable expertlink = (from a in competitionDataBase.zExpertsAndApplicationMappingTable where a.FK_ApplicationsTable == applicationId && a.FK_UsersTable == n.FK_UsersTable select a).FirstOrDefault(); if (expertlink == null) { zExpertsAndApplicationMappingTable newexpertlink = new zExpertsAndApplicationMappingTable(); newexpertlink.Active = true; newexpertlink.FK_ApplicationsTable = currentApplication.ID; newexpertlink.FK_UsersTable = n.FK_UsersTable; competitionDataBase.zExpertsAndApplicationMappingTable.InsertOnSubmit(newexpertlink); competitionDataBase.SubmitChanges(); } else { if (expertlink.Active == false) { expertlink.Active = true; competitionDataBase.SubmitChanges(); } } } } } Response.Redirect("ApplicationExpertsAndExpertsGroupEdit.aspx"); }
protected void SaveButtonClick(object sender, EventArgs e) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); var sessionParam = Session["CompetitionID"]; var userId = Session["UserID"]; if (sessionParam != null && userId != null) { int iD = (int)sessionParam; int user = (int)userId; if (iD > 0) { zCompetitionsTable currentCompetition = (from a in competitionDataBase.zCompetitionsTable where a.Active == true && a.ID == iD select a).FirstOrDefault(); if (currentCompetition != null) { foreach (ListItem current in CheckBoxList1.Items) { zActionsCompetitionsMappingTable action = (from a in competitionDataBase.zActionsCompetitionsMappingTable where a.FK_Competiton == iD && a.FK_ActionPR == Convert.ToInt32(current.Value) select a).FirstOrDefault(); if (action != null) { if (current.Selected == true) { action.Active = true; competitionDataBase.SubmitChanges(); } } else { action = new zActionsCompetitionsMappingTable(); action.Active = current.Selected; action.FK_Competiton = iD; action.FK_ActionPR = Convert.ToInt32(current.Value); competitionDataBase.zActionsCompetitionsMappingTable.InsertOnSubmit(action); competitionDataBase.SubmitChanges(); } } currentCompetition.Name = NameTextBox.Text; currentCompetition.Budjet = Convert.ToDouble(BudjetTextBox.Text); currentCompetition.FK_Curator = user; currentCompetition.StartDate = Calendar1.SelectedDate; currentCompetition.EndDate = Calendar2.SelectedDate; competitionDataBase.SubmitChanges(); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Готово!');", true); } } } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Ошибка!');", true); }
public void SaveChanges() { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); foreach (GridViewRow currentRow in PartnersGV.Rows) { Label partnerID = (Label)currentRow.FindControl("ID"); TextBox surname = (TextBox)currentRow.FindControl("Surname"); TextBox name = (TextBox)currentRow.FindControl("Name"); TextBox patronymic = (TextBox)currentRow.FindControl("Patronymic"); CheckBox role = (CheckBox)currentRow.FindControl("Role"); if (partnerID != null) { zPartnersTable currentpartner = (from a in competitionDataBase.zPartnersTable where a.ID == Convert.ToInt32(partnerID.Text) select a).FirstOrDefault(); if (currentpartner != null) { if (surname.Text.Any() && name.Text.Any() && patronymic.Text.Any()) { currentpartner.Surname = surname.Text; currentpartner.Name = name.Text; currentpartner.Patronymic = patronymic.Text; currentpartner.Role = role.Checked; competitionDataBase.SubmitChanges(); } } } } }
protected void Button2_Click(object sender, EventArgs e) { var sessionParam1 = Session["ApplicationID"]; var sessionParam2 = Session["UserID"]; if ((sessionParam1 == null) || (sessionParam2 == null)) { //error Response.Redirect("~/Default.aspx"); } int applicationId = Convert.ToInt32(sessionParam1); int userId = Convert.ToInt32(sessionParam2); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); List <zExpertPointsValue> currentApplication = (from a in competitionDataBase.zExpertPointsValue where a.Active == true && a.FK_ApplicationTable == applicationId && a.FK_ExpertsTable == userId select a).ToList(); foreach (zExpertPointsValue current in currentApplication) { current.Sended = true; current.SendedDataTime = DateTime.Now; competitionDataBase.SubmitChanges(); } Response.Redirect("~/Default.aspx"); }
protected void DeleteExpertButtonClick(object sender, EventArgs e) { var sessionParam1 = Session["ApplicationID"]; ImageButton button = (ImageButton)sender; if (sessionParam1 == null && button != null) { //error Response.Redirect("~/Default.aspx"); } int applicationId = Convert.ToInt32(sessionParam1); int userId = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zApplicationTable currentApplication = (from a in competitionDataBase.zApplicationTable where a.Active == true && a.Accept == false && a.ID == applicationId && a.Sended == true select a).FirstOrDefault(); if (currentApplication != null) { zExpertsAndApplicationMappingTable expertlink = (from a in competitionDataBase.zExpertsAndApplicationMappingTable where a.Active == true && a.FK_ApplicationsTable == applicationId && a.FK_UsersTable == userId select a).FirstOrDefault(); if (expertlink != null) { expertlink.Active = false; competitionDataBase.SubmitChanges(); } } Response.Redirect("ApplicationExpertsAndExpertsGroupEdit.aspx"); }
protected void ExpertDeleteButtonClick(object sender, EventArgs e) { Button button = (Button)sender; if (button != null) { var IdTmp = Session["GroupID"]; if (IdTmp == null) { Response.Redirect("Main.aspx"); } int groupid = Convert.ToInt32(IdTmp); CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); zExpertAndExpertGroupMappingTable expertdelete = (from a in CompetitionsDataBase.zExpertAndExpertGroupMappingTable where a.FK_UsersTable == Convert.ToInt32(button.CommandArgument) && a.Active == true && a.FK_ExpertGroupTable == groupid select a).FirstOrDefault(); if (expertdelete != null) { expertdelete.Active = false; CompetitionsDataBase.SubmitChanges(); } } Response.Redirect("CompetitionExpertEdit.aspx"); }
protected void StartStopButtonClick(object sender, EventArgs e) { Button button = (Button)sender; { int iD = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zCompetitionsTable competitionToChangeStatus = (from a in competitionDataBase.zCompetitionsTable where a.ID == iD select a).FirstOrDefault(); if (competitionToChangeStatus != null) { if (competitionToChangeStatus.OpenForApplications == null) { competitionToChangeStatus.OpenForApplications = true; } else { competitionToChangeStatus.OpenForApplications = !competitionToChangeStatus.OpenForApplications; } competitionDataBase.SubmitChanges(); } else { //error } } Response.Redirect("ChooseCompetition.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); zExpertGroup newgrouplist = new zExpertGroup(); newgrouplist.Active = true; newgrouplist.Name = TextBox1.Text; CompetitionsDataBase.zExpertGroup.InsertOnSubmit(newgrouplist); CompetitionsDataBase.SubmitChanges(); }
protected void Button1_Click(object sender, EventArgs e) { CompetitionDataContext manual = new CompetitionDataContext(); zTaskPRManualTable newtask = new zTaskPRManualTable(); newtask.Active = true; newtask.TaskPR = TextBox1.Text; manual.zTaskPRManualTable.InsertOnSubmit(newtask); manual.SubmitChanges(); GridviewApdate(); }
protected void Button1_Click1(object sender, EventArgs e) { CompetitionDataContext manual = new CompetitionDataContext(); zIndicatorManualTable newindicator = new zIndicatorManualTable(); newindicator.Active = true; newindicator.IndicatorName = TextBox1.Text; newindicator.IndicatorValue = Convert.ToInt32(TextBox2.Text); manual.zIndicatorManualTable.InsertOnSubmit(newindicator); manual.SubmitChanges(); GridviewApdate(); }
protected void Button1_Click(object sender, EventArgs e) { var sessionParam = Session["CompetitionID"]; if (sessionParam == null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Ошибка!');", true); } else { int iD = (int)sessionParam; if (iD > 0) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); foreach (ListItem current in CheckBoxList1.Items) { zFormCompetitionMappingTable currentlink = (from a in competitionDataBase.zFormCompetitionMappingTable where a.FK_Competition == iD && a.FK_Form == Convert.ToInt32(current.Value) select a).Distinct().FirstOrDefault(); if (currentlink != null) { currentlink.Active = current.Selected; competitionDataBase.SubmitChanges(); } else { zFormCompetitionMappingTable newlink = new zFormCompetitionMappingTable(); newlink.FK_Competition = iD; newlink.FK_Form = Convert.ToInt32(current.Value); newlink.Active = current.Selected; competitionDataBase.zFormCompetitionMappingTable.InsertOnSubmit(newlink); competitionDataBase.SubmitChanges(); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Готово!');", true); Response.Redirect("CuratorCompetition.aspx"); } } } } }
protected void SaveAllButton_Click(object sender, EventArgs e) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); var sessionParam1 = Session["CompetitionID"]; var sessionParam2 = Session["ConstantListID"]; if ((sessionParam1 == null) || (sessionParam2 == null)) { //error Response.Redirect("ChooseConstantList.aspx"); } int competitionId = (int)sessionParam1; int constantListId = (int)sessionParam2; DataType dataType = new DataType(); foreach (GridViewRow currentRow in ConstantListValuesGV.Rows) { Label idLabel = (Label)currentRow.FindControl("ID"); if (idLabel != null) { zCollectedDataTable currentCollectedData = (from a in competitionDataBase.zCollectedDataTable where a.ID == Convert.ToInt32(idLabel.Text) select a).FirstOrDefault(); if (currentCollectedData != null) { TextBox currentTextBox = (TextBox)currentRow.FindControl("ConstValueTextBox"); currentCollectedData.ValueText = currentTextBox.Text; competitionDataBase.SubmitChanges(); } } } zConstantListTable currentConstantList = (from a in competitionDataBase.zConstantListTable where a.ID == constantListId select a).FirstOrDefault(); currentConstantList.Name = ConstantListNameTextBox.Text; competitionDataBase.SubmitChanges(); }
protected void NewLink(int applicationId, string linkOut) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zDocumentsTable newDocument = new zDocumentsTable(); newDocument.Active = true; newDocument.FK_ApplicationTable = applicationId; newDocument.Name = null; newDocument.LinkOut = linkOut; newDocument.AddDateTime = DateTime.Now; competitionDataBase.zDocumentsTable.InsertOnSubmit(newDocument); competitionDataBase.SubmitChanges(); }
protected void SendApplication(int applicationId) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zApplicationTable currentApplication = (from a in competitionDataBase.zApplicationTable where a.Active == true && a.ID == applicationId select a).FirstOrDefault(); currentApplication.Sended = true; currentApplication.SendedDataTime = DateTime.Now; competitionDataBase.SubmitChanges(); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Заявка отправлена на рассмотрение!');", true); Response.Redirect("UserMainPage.aspx"); }
protected void DeleteButtonClick(object sender, EventArgs e) { SaveDates(); Button button = (Button)sender; { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zDocumentsTable currentDocument = (from a in competitionDataBase.zDocumentsTable where a.ID == Convert.ToInt32(button.CommandArgument) select a).FirstOrDefault(); if (currentDocument != null) { currentDocument.Active = false; competitionDataBase.SubmitChanges(); } Response.Redirect("ChooseApplicationAction.aspx"); } }
protected void BackToUserButtonClick(object sender, EventArgs e) { Button button = (Button)sender; if (button != null) { int iD = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zApplicationTable currentApplication = (from a in competitionDataBase.zApplicationTable where a.Active == true && a.ID == iD && a.Sended == true select a).FirstOrDefault(); if (currentApplication != null) { currentApplication.Sended = false; competitionDataBase.SubmitChanges(); } } Response.Redirect("ChooseApplication.aspx"); }
protected void DeleteButtonClick(object sender, EventArgs e) { Button button = (Button)sender; { int iD = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zColumnTable columnToDelete = (from a in competitionDataBase.zColumnTable where a.ID == iD select a).FirstOrDefault(); if (columnToDelete != null) { columnToDelete.Active = false; competitionDataBase.SubmitChanges(); } else { //error } } }
protected void OpenButtonClick(object sender, EventArgs e) { Button button = (Button)sender; { int iD = Convert.ToInt32(button.CommandArgument); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zCompetitionsTable currentApplication = (from a in competitionDataBase.zCompetitionsTable where a.Active == true && a.ID == iD select a).FirstOrDefault(); if (currentApplication != null) { currentApplication.Sended = true; //currentApplication.SendedDataTime = DateTime.Now; competitionDataBase.SubmitChanges(); } } Response.Redirect("CuratorCompetition.aspx"); }
protected void CreateNewConstanListButton_Click(object sender, EventArgs e) { var sessionParam1 = Session["CompetitionID"]; if (sessionParam1 == null) { //error Response.Redirect("ChooseConstantList.aspx"); } int competitionId = (int)sessionParam1; CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zConstantListTable newConstantList = new zConstantListTable(); newConstantList.FK_CompetitionTable = competitionId; newConstantList.Active = true; newConstantList.Name = ""; competitionDataBase.zConstantListTable.InsertOnSubmit(newConstantList); competitionDataBase.SubmitChanges(); Session["ConstantListID"] = newConstantList.ID; Response.Redirect("ConstantListCreate.aspx"); }
protected void SaveDates() { var sessionParam1 = Session["ApplicationID"]; if ((sessionParam1 == null)) { Response.Redirect("ChooseApplication.aspx"); } int applicationId = Convert.ToInt32(sessionParam1); CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zApplicationTable currentApplication = (from a in competitionDataBase.zApplicationTable where a.ID == applicationId select a).FirstOrDefault(); if (currentApplication != null) { var start = Request["ctl00$MainContent$startdata"]; var end = Request["ctl00$MainContent$enddata"]; try { currentApplication.StartProjectDate = Convert.ToDateTime(start).Date; } catch { } try { currentApplication.EndProjectDate = Convert.ToDateTime(end).Date; } catch { } competitionDataBase.SubmitChanges(); } }
protected void AddRowButton_Click(object sender, EventArgs e) { var sessionParam1 = Session["CompetitionID"]; var sessionParam2 = Session["ConstantListID"]; if ((sessionParam1 == null) || (sessionParam2 == null)) { //error Response.Redirect("ChooseConstantList.aspx"); } int competitionId = (int)sessionParam1; int constantListId = (int)sessionParam2; CompetitionDataContext competitionDataBase = new CompetitionDataContext(); zCollectedDataTable newCollectedConstant = new zCollectedDataTable(); newCollectedConstant.FK_ConstantListTable = constantListId; newCollectedConstant.Active = true; newCollectedConstant.CreateDateTime = DateTime.Now; newCollectedConstant.LastChangeDateTime = DateTime.Now; competitionDataBase.zCollectedDataTable.InsertOnSubmit(newCollectedConstant); competitionDataBase.SubmitChanges(); Response.Redirect("ConstantListCreate.aspx"); }
protected void CreateSaveButtonClick(object sender, EventArgs e) { CompetitionDataContext competitionDataBase = new CompetitionDataContext(); var sessionParam = Session["CompetitionID"]; if (sessionParam == null) { //error Response.Redirect("ChooseCompetition.aspx"); } else { int iD = (int)sessionParam; if (iD > 0) { if ((NameTextBox.Text.Length > 0) && (DescriptionTextBox.Text.Length > 0)) { zCompetitionsTable currentCompetition = (from a in competitionDataBase.zCompetitionsTable where a.Active == true && a.ID == iD select a).FirstOrDefault(); if (currentCompetition == null) { //error Response.Redirect("ChooseCompetition.aspx"); } else { currentCompetition.Name = NameTextBox.Text; currentCompetition.Number = DescriptionTextBox.Text; currentCompetition.Budjet = Convert.ToDouble(BudjetTextBox.Text); // currentCompetition.FK_Curator = Convert.ToInt32(DropDownList1.SelectedIndex); currentCompetition.StartDate = Calendar1.SelectedDate; currentCompetition.EndDate = Calendar2.SelectedDate; if (FileUpload1.HasFile) { try { String path = Server.MapPath("~/documents/templates"); Directory.CreateDirectory(path + "\\\\" + currentCompetition.ID.ToString()); FileUpload1.PostedFile.SaveAs(path + "\\\\" + currentCompetition.ID.ToString() + "\\\\" + FileUpload1.FileName); currentCompetition.TemplateDocName = FileUpload1.FileName; // FileStatusLabel.Text = "Файл загружен!"; } catch (Exception ex) { // FileStatusLabel.Text = "Не удалось загрузить файл."; } } if (FileUpload2.HasFile) { try { String path = Server.MapPath("~/documents/templatesWithNoMark"); Directory.CreateDirectory(path + "\\\\" + currentCompetition.ID.ToString()); FileUpload2.PostedFile.SaveAs(path + "\\\\" + currentCompetition.ID.ToString() + "\\\\" + FileUpload2.FileName); currentCompetition.TemplateDocWithoutMarksName = FileUpload2.FileName; // FileStatusLabel.Text = "Файл загружен!"; } catch (Exception ex) { // FileStatusLabel.Text = "Не удалось загрузить файл."; } } competitionDataBase.SubmitChanges(); } } } else { if ((NameTextBox.Text.Length > 0) && (DescriptionTextBox.Text.Length > 0)) { zCompetitionsTable newCompetition = new zCompetitionsTable(); newCompetition.Name = NameTextBox.Text; newCompetition.Number = DescriptionTextBox.Text; newCompetition.Budjet = Convert.ToDouble(BudjetTextBox.Text); // newCompetition.FK_Curator = Convert.ToInt32(DropDownList1.SelectedIndex); newCompetition.StartDate = Calendar1.SelectedDate; newCompetition.EndDate = Calendar2.SelectedDate; newCompetition.Active = true; newCompetition.OpenForApplications = false; competitionDataBase.zCompetitionsTable.InsertOnSubmit(newCompetition); competitionDataBase.SubmitChanges(); if (FileUpload1.HasFile) { try { String path = Server.MapPath("~/documents/templates"); Directory.CreateDirectory(path + "\\\\" + newCompetition.ID.ToString()); FileUpload1.PostedFile.SaveAs(path + "\\\\" + newCompetition.ID.ToString() + "\\\\" + FileUpload1.FileName); newCompetition.TemplateDocName = FileUpload1.FileName; // FileStatusLabel.Text = "Файл загружен!"; } catch (Exception ex) { // FileStatusLabel.Text = "Не удалось загрузить файл."; } } if (FileUpload2.HasFile) { try { String path = Server.MapPath("~/documents/templatesWithNoMark"); Directory.CreateDirectory(path + "\\\\" + newCompetition.ID.ToString()); FileUpload2.PostedFile.SaveAs(path + "\\\\" + newCompetition.ID.ToString() + "\\\\" + FileUpload2.FileName); newCompetition.TemplateDocWithoutMarksName = FileUpload2.FileName; // FileStatusLabel.Text = "Файл загружен!"; } catch (Exception ex) { // FileStatusLabel.Text = "Не удалось загрузить файл."; } } competitionDataBase.SubmitChanges(); } } } Response.Redirect("ChooseCompetition.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var sessionParam1 = Session["ApplicationID"]; var sessionParam2 = Session["UserID"]; if ((sessionParam1 == null) || (sessionParam2 == null)) { //error Response.Redirect("~/Default.aspx"); } int applicationId = Convert.ToInt32(sessionParam1); int userId = Convert.ToInt32(sessionParam2); CompetitionDataContext CompetitionsDataBase = new CompetitionDataContext(); List <zExpertPoints> expertPointsList = (from a in CompetitionsDataBase.zExpertPoints where a.Active == true && a.ID != 6 select a).ToList(); DataTable dataTable = new DataTable(); dataTable.Columns.Add("ID", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Text", typeof(string)); dataTable.Columns.Add("ErrorText", typeof(string)); dataTable.Columns.Add("MaxValue", typeof(int)); dataTable.Columns.Add("MinValue", typeof(int)); foreach (zExpertPoints currentExpertPoint in expertPointsList) { zExpertPointsValue currentExpertPointValue = (from a in CompetitionsDataBase.zExpertPointsValue where a.FK_ApplicationTable == applicationId && a.FK_ExpertsTable == userId && a.FK_ExpertPoints == currentExpertPoint.ID && a.Sended == false select a).FirstOrDefault(); if (currentExpertPointValue == null) { currentExpertPointValue = new zExpertPointsValue(); currentExpertPointValue.FK_ApplicationTable = applicationId; currentExpertPointValue.FK_ExpertsTable = userId; currentExpertPointValue.FK_ExpertPoints = currentExpertPoint.ID; currentExpertPointValue.Sended = false; currentExpertPointValue.Active = true; CompetitionsDataBase.zExpertPointsValue.InsertOnSubmit(currentExpertPointValue); CompetitionsDataBase.SubmitChanges(); } DataRow dataRow = dataTable.NewRow(); dataRow["ID"] = currentExpertPointValue.ID; dataRow["Name"] = currentExpertPoint.Name; dataRow["ErrorText"] = "Значение должно быть в диапазоне от 0 до " + currentExpertPoint.MaxValue; dataRow["MaxValue"] = currentExpertPoint.MaxValue; dataRow["MinValue"] = currentExpertPoint.MinValue; if (currentExpertPointValue.Value != null) { dataRow["Text"] = currentExpertPointValue.Value; } else { dataRow["Text"] = ""; } dataTable.Rows.Add(dataRow); } EvaluateGV.DataSource = dataTable; EvaluateGV.DataBind(); #region doComment zExpertPointsValue commentExpertPointValue = (from a in CompetitionsDataBase.zExpertPointsValue where a.FK_ApplicationTable == applicationId && a.FK_ExpertsTable == userId && a.FK_ExpertPoints == 6 select a).FirstOrDefault(); if (commentExpertPointValue == null) { commentExpertPointValue = new zExpertPointsValue(); commentExpertPointValue.FK_ApplicationTable = applicationId; commentExpertPointValue.FK_ExpertsTable = userId; commentExpertPointValue.LastChangeDataTime = DateTime.Now; commentExpertPointValue.FK_ExpertPoints = 6; commentExpertPointValue.Sended = false; CompetitionsDataBase.zExpertPointsValue.InsertOnSubmit(commentExpertPointValue); CompetitionsDataBase.SubmitChanges(); } if (commentExpertPointValue.Value != null) { CommentTextBox.Text = commentExpertPointValue.Value; } else { CommentTextBox.Text = ""; } ViewState["CommentID"] = commentExpertPointValue.ID; #endregion } }