public void CreateNewEvaluation(Model.Evaluation evaluation) { try { // Create Evaluation this.evaluationRepository.Add(evaluation); this.unitOfWork.Commit(); var newId = evaluation.Id; foreach (var p in this.practiceRepository.GetAll()) { var evalPractice = new EvaluationPractice(); evalPractice.EvaluationId = newId; evalPractice.EvaluationPracticeId = p.Id; this.evaluationPracticeRepository.Add(evalPractice); } this.unitOfWork.Commit(); } catch (Exception ex) { throw; } }
protected void Save_Click(object sender, EventArgs e) { string strErr = ""; if (txtSelf.Text.Trim().Length == 0) { strErr += "自评不能为空!\\n"; } if (strErr != "") { Maticsoft.Common.MessageBox.Show(this, strErr); return; } Eva.BLL.Evaluation bllEva = Eva.BLL.BLLFactory.GetEvaluationBLLInstance(); Eva.Model.Evaluation eva = new Model.Evaluation(); int id = int.Parse(Request["id"]); eva = bllEva.GetModel(id); eva.SelfEvaluation = txtSelf.Text; if (bllEva.Update(eva)) { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "自评成功!", "ShowEva.aspx"); } else { Maticsoft.Common.MessageBox.Show(this, "自评失败!"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var items = itemBll.GetModelList(""); if (context.Request["ctl00$ContentPlaceHolder1$studentId"] != null) { int id = int.Parse(context.Request["ctl00$ContentPlaceHolder1$studentId"]); //int teacherId = Convert.ToInt32((context.Session["user"] as Model.WebUser).Id); var eva = new Model.Evaluation(); if (DateTime.Now.Month > 8 || DateTime.Now.Month < 2) { eva.SchoolTerm = 1; } else { eva.SchoolTerm = 2; } eva.AcademicYear = DateTime.Now.Year; eva.StudentId = 1; //todo eva.TeacherId = 1; int evaID = evaBll.Add(eva); if (evaID > 0) { foreach (var item in items) { if (context.Request["score" + item.Id] != null && context.Request["word" + item.Id] != null) { int score = int.Parse(context.Request["score" + item.Id].ToString()); string word = context.Request["word" + item.Id].ToString(); var itemList = new Model.ItemList(); itemList.EvaluationId = evaID; itemList.ItemId = item.Id; itemList.score = score; itemList.Evaluation = word; itemListBll.Add(itemList); } } context.Response.Redirect("StudentList.aspx"); } } }
private void Bing() { user = Session["user"] as Model.WebUser; Name.Text = user.Name; decimal ave = Ave(Convert.ToInt32(user.StudentId)); List<Eva.Model.Evaluation> list = bllEva.GetModelList(string.Format("StudentId={0} and AcademicYear={1} and SchoolTerm={2}", user.Id, YearList.SelectedValue, Termlist.SelectedValue)); if (list.Count > 0) { eva = list[0] as Model.Evaluation; eva.Ave = Convert.ToDecimal(ave); bllEva.Update(eva); } List<Eva.Model.ItemList> ItemList = bllItemList.GetModelList(" EvaluationId=" + eva.Id); decimal sum = 0; decimal sumValue = 0; if (ItemList.Count > 0) { for (int i = 0; i < ItemList.Count; i++) { sum += Convert.ToInt32(ItemList[i].Evaluation) * Convert.ToInt32(bllItem.GetModel(Convert.ToInt32(ItemList[i].ItemId)).Value) / 100; } } List<Eva.Model.Item> list1 = bllItem.GetModelAllList(); for (int i = 0; i < list1.Count; i++) { sumValue += Convert.ToInt32(list1[i].Value); } sum = sum + ave * (100 - sumValue) / 100; eva.Total = sum; bllEva.Update(eva); txtSelf.Text = eva.SelfEvaluation; txtTeacherEva.Text = eva.TeacherEvaluation; txtAve.Text = ave.ToString(); txtComEva.Text = sum.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { if (Session["user"] != null) { var user = Session["user"] as Model.WebUser; if (user.AuthorityId == 2) { var items = itemBll.GetModelList(""); var eva = new Model.Evaluation(); if (DateTime.Now.Month > 8 || DateTime.Now.Month < 2) { eva.SchoolTerm = 1; } else { eva.SchoolTerm = 2; } eva.AcademicYear = DateTime.Now.Year; eva.StudentId = int.Parse(studentId.Value); //todo eva.TeacherId = 1; int evaID = evaBll.Add(eva); if (evaID > 0) { for (int i = 0; i < ItemRepeater.Controls.Count; i++) { HiddenField ItemId = (HiddenField)ItemRepeater.Items[i].FindControl("ItemId"); TextBox score = (TextBox)ItemRepeater.Items[i].FindControl("score"); TextBox word = (TextBox)ItemRepeater.Items[i].FindControl("word"); var itemList = new Model.ItemList(); itemList.EvaluationId = evaID; itemList.ItemId = int.Parse(ItemId.Value); itemList.Evaluation = word.Text; if (ItemId.Value == "2") { itemList.score = 80; var list = award.GetModelList("StudentId=" + studentId.Value + " And SchoolTerm = " + eva.SchoolTerm + " and AcademicYear = " + DateTime.Now.Year); foreach (var item in list) { if (item.IsCheck == "同意") { itemList.score += item.Total; } } } else { itemList.score = int.Parse(score.Text); } itemListBll.Add(itemList); } } Maticsoft.Common.MessageBox.ShowAndRedirect(this, "评价成功!", "StudentList.aspx"); } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "权限限制,请重新登录", "../login.aspx"); } } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "权限限制,请重新登录", "../login.aspx"); } }
public void Delete(Model.Evaluation Evaluation) { this.evaluationRepository.Delete(Evaluation); this.unitOfWork.Commit(); }
public void Add(Model.Evaluation Evaluation) { this.evaluationRepository.Add(Evaluation); this.unitOfWork.Commit(); }