public static bool Insert(EvaluatorComment model, ref string e) { string sql = "insert into tb_EvaluatorComment values(@ecEvaluatedID,@ecComment)"; SqlParameter[] parameters = { new SqlParameter("@ecEvaluatedID", SqlDbType.VarChar,10), new SqlParameter("@ecComment",SqlDbType.NVarChar,50), }; parameters[0].Value = model.EcEvaluatedID; parameters[1].Value = model.EcComment; string exception = db.InsertExec(sql, parameters); if (exception != "" && exception != null) { e = exception; return false; } return true; }
public static bool Select(ref List<EvaluatorComment> comments, ref string e, string sql) { DataTable table = new DataTable(); table = db.QueryDataTable(sql, ref e); if (table != null && table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { EvaluatorComment comment = new EvaluatorComment(); comment.EcEvaluatedID = (string)table.Rows[i]["ecEvaluatedID"]; comment.EcComment = (string)table.Rows[i]["ecComment"]; comments.Add(comment); } return true; } else { if (e != "" && e != null) return false; e = "查询用户不存在"; return false; } }
protected void WriteComment_Click(object sender, EventArgs e) { string exception = ""; EvaluatorComment ec = new EvaluatorComment(); ec.EcEvaluatedID = UserID.Value; ec.EcComment = EvaComment.Value; if (EvaluatorCommentBLL.Select(UserID.Value, ref exception)) { EvaluatorCommentBLL.Update(ec, ref exception); } else { EvaluatorCommentBLL.Insert(ec, ref exception); } Response.Write("<script>alert('已提交意见!')</script>"); }
public static bool Update(EvaluatorComment comment, ref string e) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_EvaluatorComment set "); strSql.Append("ecComment=@ecComment"); strSql.Append(" where ecEvaluatedID=@ecEvaluatedID "); SqlParameter[] parameters = { new SqlParameter("@ecEvaluatedID", SqlDbType.VarChar,10), new SqlParameter("@ecComment",SqlDbType.NVarChar,50), }; parameters[0].Value = comment.EcEvaluatedID; parameters[1].Value = comment.EcComment; e = db.QueryExec(strSql.ToString(), parameters); if (e != "" && e != null) { return false; } return true; }
protected void Submit_Click(object sender, EventArgs e) { List<Evaluator> model = new List<Evaluator>(); string exception = ""; string evaluated = UserID.Value; string strData = JsonChose.Value; List<TempEvaluator> tempEvaluatorList = JSON.ScriptDeserialize<List<TempEvaluator>>(strData);//从前端获取考评人名单 List<string> evaluatorList = new List<String>(); foreach (TempEvaluator te in tempEvaluatorList) { evaluatorList.Add(te.UiID); } //构造新的考评人名单 if (EvaluatorBLL.SelectByID(model, evaluated, ref exception)) { foreach (Evaluator evaluator in model) { if (evaluatorList.Contains(evaluator.UiID)) { evaluator.Pass = 1; } else { evaluator.Pass = 0; } exception = ""; if (!EvaluatorBLL.Update1(evaluator, ref exception)) { Errors.Value = exception; this.Chose.Value = "submit"; ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true); return; } } EvaluatorComment ec = new EvaluatorComment(); ec.EcEvaluatedID = evaluated; ec.EcComment = ""; EvaluatorCommentBLL.Update(ec, ref exception); this.pass.Text = "已审核"; ClientScript.RegisterStartupScript(this.GetType(), "", "doneCommit()", true); return; } Errors.Value = "考评人名单尚未制定"; this.Chose.Value = "submit"; ClientScript.RegisterStartupScript(this.GetType(), "", "tanchuang()", true); }