private static void BuildDB() { UserRecord u = new UserRecord(); u.Drop(); u.Create(); AllianceRecord a = new AllianceRecord(); a.Drop(); a.Create(); PlanetRecord p = new PlanetRecord(); p.Drop(); p.Create(); ReportRecord r = new ReportRecord(); r.Drop(); r.Create(); ResourceRecord res = new ResourceRecord(); res.Drop(); res.Create(); BuildingRecord b = new BuildingRecord(); b.Drop(); b.Create(); ResearchRecord re = new ResearchRecord(); re.Drop(); re.Create(); FleetRecord f = new FleetRecord(); f.Drop(); f.Create(); DefenceRecord d = new DefenceRecord(); d.Drop(); d.Create(); }
public static bool ParseReport(string html, ReportRecord report) { try { if (html.Contains("Nie znaleziono")) { report.Status = "Brak"; report.LastUpdate = DateTime.Now; } else { report.Status = "Jest"; //report.LastUpdate = ParseDate(html); } ResourceRecord resource = new ResourceRecord { Id = report.Id }; BuildingRecord building = new BuildingRecord { Id = report.Id }; ResearchRecord research = new ResearchRecord { Id = report.Id }; DefenceRecord defence = new DefenceRecord { Id = report.Id }; FleetRecord fleet = new FleetRecord { Id = report.Id }; Resource r = ReportResourceParser.ParseResource(html); if (r != null) { r.ToDB(resource); } Building b = ReportBuildingParser.ParseBuilding(html); if (b != null) { ObjectDumper.Dump(b, building); } Research s = ReportResearchParser.ParseResearch(html); if (s != null) { ObjectDumper.Dump(s, research); } Fleet f = ReportFleetParser.ParseFleet(html); ObjectDumper.Dump(f, fleet); Defence d = ReportDefenceParser.ParseDefence(html); ObjectDumper.Dump(d, defence); }catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(true); }
/// <summary> /// 添加答辩记录 /// </summary> /// <param name="defence">答辩记录对象</param> /// <returns></returns> public Result UpdateRecord(DefenceRecord defence) { int row = dedao.UpdateRecord(defence); if (row > 0) { return(Result.添加成功); } else { return(Result.添加失败); } }
/// <summary> /// 添加答辩学生 /// </summary> /// <param name="defence">答辩记录对象</param> /// <returns></returns> public Result InsertStudent(DefenceRecord defence) { int row = dedao.InsertStudent(defence); if (row > 0) { return(Result.添加成功); } else { return(Result.添加失败); } }
/// <summary> /// 根据选题记录id查找答辩记录信息 /// </summary> /// <param name="titleRecordId">选题记录id</param> /// <returns></returns> public DefenceRecord SelectRecord(string stuAccount, string titleRecordId) { DataSet ds = dedao.SelectRecord(titleRecordId); DefenceRecord defence = new DefenceRecord(); if (ds != null && ds.Tables[0].Rows.Count > 0) { defence.titleRecord.TitleRecordId = Convert.ToInt32(ds.Tables[0].Rows[0]["titleRecordId"].ToString()); defence.defenceGroup.defenGroupId = Convert.ToInt32(ds.Tables[0].Rows[0]["member"].ToString()); defence.recordContent = ds.Tables[0].Rows[0]["recordContent"].ToString(); return(defence); } return(null); }
/// <summary> /// 添加答辩学生 /// </summary> /// <param name="defence">答辩记录对象</param> /// <returns></returns> public int InsertStudent(DefenceRecord defence) { try { string cmdText = "insert into T_DefenceRecord(titleRecordId,defenGroupId) values(@titleRecordId,@defenGroupId)"; string[] param = { "@titleRecordId", "@defenGroupId" }; object[] values = { defence.titleRecord.TitleRecordId, defence.defenceGroup.defenGroupId }; int row = db.ExecuteNoneQuery(cmdText.ToString(), param, values); return(row); } catch (Exception ex) { throw ex; } }
/// <summary> /// 添加答辩记录 /// </summary> /// <param name="defence">答辩记录对象</param> /// <returns></returns> public int UpdateRecord(DefenceRecord defence) { try { string cmdText = "update T_DefenceRecord set recordContent = @recordContent , dateTime=@dateTime where titleRecordId = @titleRecordId"; string[] param = { "@titleRecordId", "@recordContent", "@dateTime" }; object[] values = { defence.titleRecord.TitleRecordId, defence.recordContent, defence.dateTime }; int row = db.ExecuteNoneQuery(cmdText.ToString(), param, values); return(row); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { string op = Request["op"]; try { if (op == "submit") { titleRecordId = Request["titleRecordId"]; stuAccount = Request["stuAccount"]; getData = defenceBll.getModel(titleRecordId); DefenceRecord defenceRecord = new DefenceRecord(); TitleRecord titleRecord = new TitleRecord(); titleRecord.TitleRecordId = Convert.ToInt32(getData.Tables[0].Rows[0]["titleRecordId"]); defenceRecord.titleRecord = titleRecord; defenceRecord.recordContent = Request["content"]; defenceRecord.dateTime = Convert.ToDateTime(now); Result result = defenceBll.UpdateRecord(defenceRecord); if (result == Result.添加成功) { LogHelper.Info(this.GetType(), titleRecord.DefeseTeamId + " - 教师提交 - " + titleRecord.student.StuAccount + " - " + titleRecord.student.RealName + " - 学生的答辩记录"); Response.Write("添加成功"); Response.End(); } else { Response.Write("添加失败"); Response.End(); } } else { reportData(); } } catch (Exception ex) { LogHelper.Error(this.GetType(), ex); } }
/// <summary> /// 添加学生 /// </summary> /// <returns></returns> public Result addStudent() { string stuAccount = Request["stuAccount"]; string[] stuList = stuAccount.Split('?'); for (int i = 0; i < stuList.Length - 1; i++) { TitleRecordBll titleBll = new TitleRecordBll(); TitleRecord titleRecord = titleBll.getRtId(stuList[i]); int titleRecordId = titleRecord.TitleRecordId; DefenceBll defenceBll = new DefenceBll(); DefenceRecord defence = new DefenceRecord(); defence.titleRecord = titleRecord; DefenceGroup defenceGroup = new DefenceGroup(); int defenId = Convert.ToInt32(Session["defenGroupId"]); defenceGroup.defenGroupId = defenId; defence.defenceGroup = defenceGroup; row = defenceBll.InsertStudent(defence); StudentBll stuBll = new StudentBll(); Student student = stuBll.GetModel(stuList[i]); string stu = stuList[i]; student.state = 1; Result result = stuBll.Updata(student); if (row != Result.添加成功 || result != Result.更新成功) { Response.Write("添加失败"); Response.End(); break; } else { LogHelper.Info(this.GetType(), tea.TeaAccount + " - " + tea.TeaName + " - 添加" + defenId + "答辩小组学生 - " + student.StuAccount + " - " + student.RealName); } } return(row); }