private void btn_Save_Click(object sender, EventArgs e) { StructureOfProblem pro = null; foreach (int key in problems.Keys) { if (this.Main_TreeView.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName) { ProblemList.GetProblem(key).QuestionName = this.Main_TreeView.SelectedNode.Text; ProblemList.GetProblem(key).QuestionDescription = this.ProDescTextBox.Text; ProblemList.GetProblem(key).OutputSample = this.OutputsampleText.Text; ProblemList.GetProblem(key).Problemcode = this.StdAnswerTextBox.Text; ProblemList.GetProblem(key).InputSample = this.InputSampleText.Text; pro = ProblemList.GetProblem(key); } if (ProblemList.GetProblem(key).QuestionName == "新练习") { ProblemList.GetProblem(key).QuestionName = this.Main_TreeView.SelectedNode.Text; ProblemList.GetProblem(key).QuestionDescription = this.ProDescTextBox.Text; } } if (pro != null) { ProblemList.UpdateStatus(pro); } }
public JsonResult <Response> AddProblem(int listId, int probId) { ProblemList pl = db.ProblemLists.First(p => p.Id == listId); if (pl == null) { return(Json(new Response { Status = HttpStatusCode.BadRequest, Message = "Invalid list ID" })); } if (pl.ProblemListEntries.Where(p => p.ProblemId == probId).Count() > 0) { return(Json(new Response { Status = HttpStatusCode.OK, Message = "Problem already on list" })); } ProblemListEntry ple = db.ProblemListEntries.Create(); ple.ProblemListId = listId; ple.ProblemId = probId; pl.ProblemListEntries.Add(ple); db.SaveChanges(); return(Json(new Response { Status = HttpStatusCode.OK, Message = "Added" })); }
public void EditShow() { StructureOfProblem problem = new StructureOfProblem(); problem.ProblemID = 1; problem.QuestionName = "动态规划"; problem.InputSample = "1 7 4 9 2 5\r\n1 2 3 4 5 6 7 8 9"; problem.OutputSample = "6\r\n2"; ProblemList.GetAll().Clear(); ProblemList.Add(problem); ProblemUpdate problemUpdate = new ProblemUpdate(problem.ProblemID); Assert.AreEqual(problemUpdate.QuestionName, problem.QuestionName); Assert.AreEqual(problemUpdate.InputSamples, problem.InputSample); Assert.AreEqual(problemUpdate.OutputSamples, problem.OutputSample); Assert.AreEqual(problemUpdate.QuestionDescription, problem.QuestionDescription); //修改题目名字 string newQuestionName = "贪心"; problemUpdate.QuestionName = newQuestionName; Assert.AreEqual(problemUpdate.QuestionName, newQuestionName); }
//private StructureOfQuestionbank structureOfQuestionbank = new StructureOfQuestionbank(); public ProblemStructure(int ID) { this.ID = ID; this.Location = new System.Drawing.Point(500, 500); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; InitializeComponent(); try { structureOfProblem = ProblemList.GetProblem(ID); this.questionName.AppendText(structureOfProblem.QuestionName); this.timeLimitIndex.AppendText(structureOfProblem.TimeLimitIndex.Length != 0 ? structureOfProblem.TimeLimitIndex : ""); this.memoryLimitIndex.AppendText(structureOfProblem.MemoryLimitIndex.Length != 0 ? structureOfProblem.MemoryLimitIndex : ""); //添加+“”,表达int向string的隐式转换 this.totalAccepts.AppendText(!structureOfProblem.TotalAccepts.Equals(0) ? structureOfProblem.TotalAccepts + "" : ""); this.totalSubmits.AppendText(!structureOfProblem.TotalSubmits.Equals(0) ? structureOfProblem.TotalSubmits + "" : ""); this.acceptsRate.AppendText(!structureOfProblem.AcceptsRate.Equals(0) ? structureOfProblem.AcceptsRate : ""); this.questionDescription.AppendText(structureOfProblem.QuestionDescription.Length != 0 ? structureOfProblem.QuestionDescription : ""); this.inputDescription.AppendText(structureOfProblem.InputDescription.Length != 0 ? structureOfProblem.InputDescription : ""); this.outputDescription.AppendText(structureOfProblem.OutputDescription.Length != 0 ? structureOfProblem.OutputDescription : ""); this.inputSample.AppendText(structureOfProblem.InputSample.Length != 0 ? structureOfProblem.InputSample : ""); this.outputDescription.AppendText(structureOfProblem.OutputSample.Length != 0 ? structureOfProblem.OutputSample : ""); this.hint.AppendText(structureOfProblem.Hint.Length != 0 ? structureOfProblem.Hint : ""); //StructureOfQuestionbank.structureOfProblem = structureOfProblem; } catch { } }
private void buttondelete_Click(object sender, EventArgs e) { Boolean Checked = true; for (int i = 0; i < this.show_question.Items.Count; i++) { if (this.show_question.Items[i].Checked == true) { Checked = false; ProblemList.Delete(int.Parse(this.show_question.Items[i].SubItems[1].Text)); ProblemList.Save(); ; } } //MessageBox.Show(this.show_question.Items[2].SubItems[1].Text); if (Checked) { MessageBox.Show("没有选择要删除的题目"); } else { this.show_question.Items.Clear(); showlist(); } }
private void Student_Interface_Load(object sender, EventArgs e) { this.Main_TreeView.LabelEdit = true;//可编辑状态。 //添加一个节点,这个结点是根节点。 TreeNode node = new TreeNode(); Main_TreeView.ImageList = imageList1; node.Text = "Php/Mysql三日通"; this.Main_TreeView.Nodes.Add(node); TreeNode node1 = new TreeNode(); node1.Text = "第一天"; node.Nodes.Add(node1); foreach (int key in problems.Keys) { TreeNode minnode = new TreeNode(); minnode.Text = ProblemList.GetProblem(key).QuestionName; if (ProblemList.GetProblem(key).Status == 1) { minnode.ImageIndex = 1; } else if (ProblemList.GetProblem(key).Status == 0) { minnode.ImageIndex = 0; } else { minnode.ImageIndex = 2; } node1.Nodes.Add(minnode); } }
private void btn_Run_Code_Click(object sender, EventArgs e) { if (selectedProblem == null) { MessageBox.Show("当前未选择题目"); return; } PHPRunner runner = new PHPRunner(); //selectedProblem.InputSample = "1 2"; //selectedProblem.Problemcode = "<?php echo $_GET['a']; echo $_GET['b'];"; if (this.problemcode.Text == "") { MessageBox.Show("请输入解答代码!"); return; } runner.Code = this.problemcode.Text; if (selectedProblem.InputSample != "" || selectedProblem.InputSample != null) { string[] parameters = selectedProblem.InputSample.Split(' '); for (int i = 0; i < parameters.Length; i++) { runner.QueryString += "parameter" + i + "=" + parameters[i] + "&"; //runner.Code = runner.Code.Replace(Regex.Match(runner.Code,"\\$_GET\\[\\S*\\]$").Value, "$_GET['parameter"+i+"']"); } MatchCollection mc = Regex.Matches(runner.Code, "\\$_GET\\[\\S*\\]"); int j = 0; foreach (Match m in mc) { //MessageBox.Show(m.Value); runner.Code = runner.Code.Replace(m.Value, "$_GET['parameter" + j + "']"); j++; } //runner.Code = runner.Code.Replace("$_GET['a']", "$_GET['parameter0']"); // runner.Code = runner.Code.Replace("$_GET['b']", "$_GET['parameter1']"); runner.QueryString = runner.QueryString.Substring(0, runner.QueryString.Length - 1); } String res = runner.run(); Browser_output.Text = res; Answer_tabControl.SelectedTab = Browse_Output; if (res == selectedProblem.OutputSample) { this.Main_TreeView.SelectedNode.ImageIndex = 1; selectedProblem.Status = 1; MessageBox.Show("Accept"); ProblemList.UpdateStatus(selectedProblem); } else { this.Main_TreeView.SelectedNode.ImageIndex = 2; selectedProblem.Status = -1; MessageBox.Show("WrongAnswer"); ProblemList.UpdateStatus(selectedProblem); } this.Browser_output.Text = res; this.Main_TreeView.Invalidate(); }
private void ProAddBtn_Click(object sender, EventArgs e) { XmlOperator xmlOperator = new XmlOperator(); OpenFileDialog fileDialog = new OpenFileDialog(); //fileDialog.Multiselect = true; if (fileDialog.ShowDialog() == DialogResult.OK) { //MessageBox.Show(fileDialog.FileName); SerializableDictionary <int, StructureOfProblem> p = xmlOperator.readXML(fileDialog.FileName); if (this.Main_TreeView.Nodes.Count == 0 || this.Main_TreeView.SelectedNode == null) { //this.Main_TreeView.Nodes.Add(NewProblemName); foreach (int key in p.Keys) { TreeNode minnode = new TreeNode(); minnode.Text = ProblemList.GetProblem(key).QuestionName; this.Main_TreeView.Nodes.Add(minnode); ProblemList.Add(ProblemList.GetProblem(key)); } } else { //this.Main_TreeView.SelectedNode.Nodes.Add(NewProblemName); foreach (int key in p.Keys) { TreeNode minnode = new TreeNode(); minnode.Text = ProblemList.GetProblem(key).QuestionName; this.Main_TreeView.SelectedNode.Nodes.Add(minnode); ProblemList.Add(ProblemList.GetProblem(key)); } } } }
//0未完成,1是通过,2是错误 private void Main_TreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Action == TreeViewAction.ByMouse) { foreach (int key in problems.Keys) { if (e.Node.Text == ProblemList.GetProblem(key).QuestionName) { selectedProblem = ProblemList.GetProblem(key); ShowProblem(ProblemList.GetProblem(key)); if (ProblemList.GetProblem(key).Status == 1) { e.Node.ImageIndex = 1; } else if (ProblemList.GetProblem(key).Status == 0) { e.Node.ImageIndex = 0; } else { e.Node.ImageIndex = 2; } } } } }
public void Pending() { m_isPending = true; m_isActive = true; // Activate the object m_currentProblem = m_problemList[Random.Range(0, m_problemList.Count)]; // Assaigns a problem on the list of problems to be the current problem occuring. if (m_currentProblem.GetBreakParticleEffect() != null) // Checks if there is a particle effect in here for the associated problem and then activates then returns. { if (m_currentProblem.GetBreakParticleEffect().Count != 0) { List <GameObject> particle = m_currentProblem.GetBreakParticleEffect(); for (int i = 0; i < m_currentProblem.GetBreakParticleEffect().Count; i++) { GameObject t = Instantiate <GameObject>(particle[i]); //m_currentParticle.Add(t); m_currentProjectile.Add(t); m_currentProjectile[i].transform.position = this.transform.position + new Vector3(0, m_currentProblem.GetParticleStartDistance(), 0); // Sets the particle effect to start off sceen above the problem. //m_currentParticle[i].Play(); } } } if (m_currentProblem.GetSounds() != null) { if (m_currentProblem.GetSounds().Count != 0) { Timer.SoundMangerGet().Play(m_currentProblem.GetSounds(), WhenToPlaySound.Pending); } } }
void Start() { problemList = this.GetComponent <SwitchScene>().problemList; text.text = problemList.problem[currentCategory].preview; Debug.Log("MateriBackupHandler_currentCategory : " + currentCategory); this.GetComponent <SwitchScene>().userData.levelData[currentCategory].openLevel[0] = true; }
private void ClearDGVText(object sender, EventArgs e) { dateBox.Clear(); cNameBox.Clear(); IDBox.Clear(); CPN1.Clear(); CPN2.Clear(); CPN3.Clear(); phoneBrandComboBox.Text = ""; PhoneModelComboBox.Text = ""; imeiBox.Clear(); for (int i = 0; i < ProblemList.Items.Count; i++) { ProblemList.SetItemChecked(i, false); } DepositBox.Text = ""; passwordBox.Clear(); particularsBox.Items.Clear(); warrantyT.Checked = false; nopayT.Checked = false; fullpayT.Checked = false; depositT.Checked = false; particularItem.Clear(); itemQuantity.Clear(); itemUnit.Clear(); pictureBox1.Image = null; dateBox.Text = DateTime.Now.ToString("yyyy/MM/dd hh:mm"); others.Clear(); warrantyBox.Clear(); // ID Checking DataTable dt = new DataTable(); string SQL = "SELECT ID FROM InventoryTable ORDER BY ID DESC"; OleDbCommand cmd = new OleDbCommand(SQL, con); try { con.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter(cmd); adapter.Fill(dt); cmd.ExecuteNonQuery(); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } int newrow = 0; if (dt.Rows.Count > 0) { newrow = (Int32)dt.Rows[0][0]; } newrow++; IDBox.Text = newrow.ToString(); }
private void btn_Save_Click(object sender, EventArgs e) { foreach (int key in problems.Keys) { if (this.Main_TreeView.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName) { // ProblemList.GetProblem(key).QuestionDescription = this.Problem_Description_HTML.Text; } } ProblemList.Save(); }
public static void CreateProblemList() { ProblemList problemList = ScriptableObject.CreateInstance <ProblemList>(); AssetDatabase.CreateAsset(problemList, "Assets/Data/ProblemList.asset"); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = problemList; }
public JsonResult <Response> Add([FromBody] string name) { ProblemList newList = db.ProblemLists.Create(); newList.Name = name; db.ProblemLists.Add(newList); db.SaveChanges(); return(Json(new Response { Status = HttpStatusCode.OK })); }
void Start() { userData = this.GetComponent <SwitchScene>().userData; problemList = this.GetComponent <SwitchScene>().problemList; SetText(); if (finalPanel.activeInHierarchy) { finalPanel.SetActive(false); } }
// Use this for initialization void Start() { StringReader xml = new StringReader(problemXml.text); problemList = ProblemList.LoadProblemList(xml); currentProblemId = 0; currentProblemSetId = 0; UpdateCurrentSelection(); GoToList(0); }
public JsonResult <ProblemResponse> Choose(int id) { ProblemList pl = db.ProblemLists.Find(id); List <ProblemProxy> problems = new List <ProblemProxy>(); foreach (ProblemListEntry ple in pl.ProblemListEntries) { problems.Add(new ProblemProxy(ple.Problem)); } return(Json(new ProblemResponse { Status = HttpStatusCode.OK, Problems = problems })); }
private void ProExportBtn_Click(object sender, EventArgs e) { FolderBrowserDialog path = new FolderBrowserDialog(); if (path.ShowDialog() == DialogResult.OK) { // MessageBox.Show(path.SelectedPath); SerializableDictionary <int, StructureOfProblem> problems = ProblemList.GetAll(); XmlOperator xmlOperator = new XmlOperator(); xmlOperator.XMLSerialized(path.SelectedPath + "//Problem.xml", problems); } }
private void delete(object sender, EventArgs e) { treeView1.Nodes.Remove(treeView1.SelectedNode); foreach (int key in problems.Keys) { if (treeView1.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName) { ProblemList.Delete(ProblemList.GetProblem(key).ProblemID); ProblemList.Save(); break; } } }
//将修改后的内容详情写入 private void writeProblem() { problem.Hint = this.Update_Hint.Text; problem.InputDescription = this.Update_InputDescription.Text; problem.InputSample = this.Update_InputSamples.Text; problem.MemoryLimitIndex = this.Update_MemLimit.Text; problem.TimeLimitIndex = this.Update_TimeLimit.Text; problem.OutputDescription = this.Update_OutputDescription.Text; problem.OutputSample = this.Update_OutputSamples.Text; problem.QuestionDescription = this.Update_QuestionDescription.Text; problem.QuestionName = this.Update_QuestionName.Text; //更新问题修改 ProblemList.Add(problem); }
private void ExecuteDropQueryCommand(DragDropQueryEventArgs obj) { var result = false; if (obj.Options.Payload is ProblemDto) { var problemDto = obj.Options.Payload as ProblemDto; var probQuery = ProblemList.FirstOrDefault( d => d.ProblemCodeCodedConcept.CodedConceptCode == problemDto.ProblemCodeCodedConcept.CodedConceptCode); result = probQuery == null; } obj.QueryResult = result; }
private void Main_TreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Action == TreeViewAction.ByMouse) { TreeNode selected = e.Node; foreach (int key in problems.Keys) { if (this.Main_TreeView.SelectedNode.Text == ProblemList.GetProblem(key).QuestionName) { selectedProblem = ProblemList.GetProblem(key); ShowProblem(ProblemList.GetProblem(key)); } } } }
private void AddButton_Click(object sender, EventArgs e) { try { if (checkProblem()) { MessageBox.Show("请完善信息"); return; } string[] inputSamples = this.InputSampleInput.Text.Split(';'); string[] outputSamples = this.OutputSampleInput.Text.Split(';'); if (inputSamples.Length != outputSamples.Length) { MessageBox.Show("输入及输出样例不匹配"); return; } string problemName = this.ProblemNameInput.Text; string timeLimit = this.TimeLimitInput.Text; string memoryLimit = this.MemoryLimitInput.Text; string inputDescription = this.InputDescriptionInput.Text; string outputDesctiption = this.OutputDescriptionInput.Text; string inputSample = this.InputSampleInput.Text; string outputSample = this.OutputSampleInput.Text; string hint = this.hintInput.Text; string decription = this.DescriptionInput.Text; StructureOfProblem newProblem = new StructureOfProblem(); newProblem.ProblemID = ProblemList.GetAll().Values.Last().ProblemID + 1; newProblem.Hint = hint; newProblem.QuestionName = problemName; newProblem.TimeLimitIndex = timeLimit; newProblem.MemoryLimitIndex = memoryLimit; newProblem.InputDescription = inputDescription; newProblem.OutputDescription = outputDesctiption; newProblem.InputSample = inputSample; newProblem.OutputSample = outputSample; newProblem.QuestionDescription = decription; ProblemList.Add(newProblem); ProblemList.Save(); MessageBox.Show("添加成功"); } catch (Exception ex) { MessageBox.Show(ex.StackTrace); return; } ((Form1)(this.ParentForm)).TurnForm(new Questionbank()); }
public JsonResult <Response> Remove(int id) { ProblemList pl = db.ProblemLists.First(p => p.Id == id); if (pl == null) { return(Json(new Response { Status = HttpStatusCode.OK, Message = "List not found" })); } db.ProblemLists.Remove(pl); db.SaveChanges(); return(Json(new Response { Status = HttpStatusCode.OK })); }
private void export_status_Click_1(object sender, EventArgs e) { SerializableDictionary <int, StructureOfProblem> problems = ProblemList.GetAll(); SerializableDictionary <int, StructureOfProblem> problemlist = new SerializableDictionary <int, StructureOfProblem>(); XmlOperator xmlOperator = new XmlOperator(); foreach (int key in problems.Keys) { StructureOfProblem p = new StructureOfProblem(); p.AcceptsRate = ProblemList.GetProblem(key).AcceptsRate; p.QuestionName = ProblemList.GetProblem(key).QuestionName; p.ProblemID = ProblemList.GetProblem(key).ProblemID; problemlist.Add(p.ProblemID, p); } xmlOperator.XMLSerialized("Problem//ProblemStatus.xml", problemlist); //MessageBox.Show("导出成功"); }
private void Problem_Add_Click(object sender, EventArgs e) { if (this.Main_TreeView.Nodes.Count == 0 || this.Main_TreeView.SelectedNode == null) { this.Main_TreeView.Nodes.Add(NewProblemName); StructureOfProblem problem = new StructureOfProblem(); problem.QuestionName = NewProblemName; ProblemList.Add(problem); } else { this.Main_TreeView.SelectedNode.Nodes.Add(NewProblemName); StructureOfProblem problem = new StructureOfProblem(); problem.QuestionName = NewProblemName; ProblemList.Add(problem); } }
private void showlist() { SerializableDictionary <int, StructureOfProblem> problems = ProblemList.GetAll(); foreach (int key in problems.Keys) { ListViewItem list = new ListViewItem(); list.Text = ProblemList.GetProblem(key).AcceptsRate; if (list.Text == "") { list.Text = "Undo"; } list.SubItems.Add(ProblemList.GetProblem(key).ProblemID.ToString()); list.SubItems.Add(ProblemList.GetProblem(key).QuestionName); this.show_question.Items.Add(list); } }
private void MainPage_Load(object sender, EventArgs e) { treeView1.LabelEdit = true;//可编辑状态。 //添加一个节点,这个结点是根节点。 TreeNode node = new TreeNode(); node.Text = "Php/Mysql三日通"; treeView1.Nodes.Add(node); TreeNode node1 = new TreeNode(); node1.Text = "第一天"; node.Nodes.Add(node1); foreach (int key in problems.Keys) { TreeNode minnode = new TreeNode(); minnode.Text = ProblemList.GetProblem(key).QuestionName; node1.Nodes.Add(minnode); } }
private void BtnSave_Click(object sender, EventArgs e) { StructureOfProblem structureOfProblem = new StructureOfProblem(); structureOfProblem.QuestionName = this.questionName.Text; structureOfProblem.TimeLimitIndex = this.timeLimitIndex.Text; structureOfProblem.MemoryLimitIndex = this.memoryLimitIndex.Text; structureOfProblem.TotalSubmits = this.totalSubmits.Text; structureOfProblem.TotalAccepts = this.totalAccepts.Text; structureOfProblem.AcceptsRate = this.acceptsRate.Text; structureOfProblem.QuestionDescription = this.questionDescription.Text; structureOfProblem.InputDescription = this.inputDescription.Text; structureOfProblem.OutputDescription = this.outputDescription.Text; structureOfProblem.InputSample = this.inputSample.Text; structureOfProblem.OutputSample = this.outputSample.Text; structureOfProblem.Hint = this.hint.Text; structureOfProblem.ProblemID = ID; ProblemList.Add(structureOfProblem); }