public bool Add(Model_S_TestingPoint model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into S_TestingPoint("); builder.Append("S_TestingPoint_Id,GradeTerm,Subject,Syllabus,Test_Category,TPLevel,Parent_Id,S_TestingPointBasic_Id,TPName,TPCode,Importance,Cognitive_Level,IsLast,CreateUser,CreateTime,UpdateUser,UpdateTime)"); builder.Append(" values ("); builder.Append("@S_TestingPoint_Id,@GradeTerm,@Subject,@Syllabus,@Test_Category,@TPLevel,@Parent_Id,@S_TestingPointBasic_Id,@TPName,@TPCode,@Importance,@Cognitive_Level,@IsLast,@CreateUser,@CreateTime,@UpdateUser,@UpdateTime)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@S_TestingPoint_Id", SqlDbType.Char, 0x24), new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@Syllabus", SqlDbType.Char, 0x24), new SqlParameter("@Test_Category", SqlDbType.Char, 0x24), new SqlParameter("@TPLevel", SqlDbType.Char, 0x24), new SqlParameter("@Parent_Id", SqlDbType.Char, 0x24), new SqlParameter("@S_TestingPointBasic_Id", SqlDbType.Char, 0x24), new SqlParameter("@TPName", SqlDbType.VarChar, 200), new SqlParameter("@TPCode", SqlDbType.VarChar, 200), new SqlParameter("@Importance", SqlDbType.Char, 0x24), new SqlParameter("@Cognitive_Level", SqlDbType.Char, 0x24), new SqlParameter("@IsLast", SqlDbType.Char, 1), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@UpdateTime", SqlDbType.DateTime) }; cmdParms[0].Value = model.S_TestingPoint_Id; cmdParms[1].Value = model.GradeTerm; cmdParms[2].Value = model.Subject; cmdParms[3].Value = model.Syllabus; cmdParms[4].Value = model.Test_Category; cmdParms[5].Value = model.TPLevel; cmdParms[6].Value = model.Parent_Id; cmdParms[7].Value = model.S_TestingPointBasic_Id; cmdParms[8].Value = model.TPName; cmdParms[9].Value = model.TPCode; cmdParms[10].Value = model.Importance; cmdParms[11].Value = model.Cognitive_Level; cmdParms[12].Value = model.IsLast; cmdParms[13].Value = model.CreateUser; cmdParms[14].Value = model.CreateTime; cmdParms[15].Value = model.UpdateUser; cmdParms[0x10].Value = model.UpdateTime; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool AddBasic(Model_S_TestingPoint model, Model_S_TestingPointBasic modelBasic) { Dictionary <string, SqlParameter[]> dictionary = new Dictionary <string, SqlParameter[]>(); StringBuilder builder = new StringBuilder(); builder = new StringBuilder(); builder.Append("insert into S_TestingPointBasic("); builder.Append("S_TestingPointBasic_Id,GradeTerm,Subject,TPNameBasic,CreateUser,CreateTime,UpdateUser,UpdateTime)"); builder.Append(" values ("); builder.Append("@S_TestingPointBasic_Id,@GradeTerm,@Subject,@TPNameBasic,@CreateUser,@CreateTime,@UpdateUser,@UpdateTime)"); SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@S_TestingPointBasic_Id", SqlDbType.Char, 0x24), new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@TPNameBasic", SqlDbType.VarChar, 200), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@UpdateTime", SqlDbType.DateTime) }; parameterArray[0].Value = modelBasic.S_TestingPointBasic_Id; parameterArray[1].Value = modelBasic.GradeTerm; parameterArray[2].Value = modelBasic.Subject; parameterArray[3].Value = modelBasic.TPNameBasic; parameterArray[4].Value = modelBasic.CreateUser; parameterArray[5].Value = modelBasic.CreateTime; parameterArray[6].Value = modelBasic.UpdateUser; parameterArray[7].Value = modelBasic.UpdateTime; dictionary.Add(builder.ToString(), parameterArray); builder = new StringBuilder(); builder.Append("insert into S_TestingPoint("); builder.Append("S_TestingPoint_Id,GradeTerm,Subject,Syllabus,Test_Category,TPLevel,Parent_Id,S_TestingPointBasic_Id,TPName,TPCode,Importance,Cognitive_Level,IsLast,CreateUser,CreateTime,UpdateUser,UpdateTime)"); builder.Append(" values ("); builder.Append("@S_TestingPoint_Id,@GradeTerm,@Subject,@Syllabus,@Test_Category,@TPLevel,@Parent_Id,@S_TestingPointBasic_Id,@TPName,@TPCode,@Importance,@Cognitive_Level,@IsLast,@CreateUser,@CreateTime,@UpdateUser,@UpdateTime)"); SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@S_TestingPoint_Id", SqlDbType.Char, 0x24), new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@Syllabus", SqlDbType.Char, 0x24), new SqlParameter("@Test_Category", SqlDbType.Char, 0x24), new SqlParameter("@TPLevel", SqlDbType.Char, 0x24), new SqlParameter("@Parent_Id", SqlDbType.Char, 0x24), new SqlParameter("@S_TestingPointBasic_Id", SqlDbType.Char, 0x24), new SqlParameter("@TPName", SqlDbType.VarChar, 200), new SqlParameter("@TPCode", SqlDbType.VarChar, 200), new SqlParameter("@Importance", SqlDbType.Char, 0x24), new SqlParameter("@Cognitive_Level", SqlDbType.Char, 0x24), new SqlParameter("@IsLast", SqlDbType.Char, 1), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@UpdateTime", SqlDbType.DateTime) }; parameterArray2[0].Value = model.S_TestingPoint_Id; parameterArray2[1].Value = model.GradeTerm; parameterArray2[2].Value = model.Subject; parameterArray2[3].Value = model.Syllabus; parameterArray2[4].Value = model.Test_Category; parameterArray2[5].Value = model.TPLevel; parameterArray2[6].Value = model.Parent_Id; parameterArray2[7].Value = model.S_TestingPointBasic_Id; parameterArray2[8].Value = model.TPName; parameterArray2[9].Value = model.TPCode; parameterArray2[10].Value = model.Importance; parameterArray2[11].Value = model.Cognitive_Level; parameterArray2[12].Value = model.IsLast; parameterArray2[13].Value = model.CreateUser; parameterArray2[14].Value = model.CreateTime; parameterArray2[15].Value = model.UpdateUser; parameterArray2[0x10].Value = model.UpdateTime; dictionary.Add(builder.ToString(), parameterArray2); return(DbHelperSQL.ExecuteSqlTran(dictionary) > 0); }
public bool Update(Model_S_TestingPoint model) { StringBuilder builder = new StringBuilder(); builder.Append("update S_TestingPoint set "); builder.Append("GradeTerm=@GradeTerm,"); builder.Append("Subject=@Subject,"); builder.Append("Syllabus=@Syllabus,"); builder.Append("Test_Category=@Test_Category,"); builder.Append("TPLevel=@TPLevel,"); builder.Append("Parent_Id=@Parent_Id,"); builder.Append("S_TestingPointBasic_Id=@S_TestingPointBasic_Id,"); builder.Append("TPName=@TPName,"); builder.Append("TPCode=@TPCode,"); builder.Append("Importance=@Importance,"); builder.Append("Cognitive_Level=@Cognitive_Level,"); builder.Append("IsLast=@IsLast,"); builder.Append("CreateUser=@CreateUser,"); builder.Append("CreateTime=@CreateTime,"); builder.Append("UpdateUser=@UpdateUser,"); builder.Append("UpdateTime=@UpdateTime"); builder.Append(" where S_TestingPoint_Id=@S_TestingPoint_Id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@Syllabus", SqlDbType.Char, 0x24), new SqlParameter("@Test_Category", SqlDbType.Char, 0x24), new SqlParameter("@TPLevel", SqlDbType.Char, 0x24), new SqlParameter("@Parent_Id", SqlDbType.Char, 0x24), new SqlParameter("@S_TestingPointBasic_Id", SqlDbType.Char, 0x24), new SqlParameter("@TPName", SqlDbType.VarChar, 200), new SqlParameter("@TPCode", SqlDbType.VarChar, 200), new SqlParameter("@Importance", SqlDbType.Char, 0x24), new SqlParameter("@Cognitive_Level", SqlDbType.Char, 0x24), new SqlParameter("@IsLast", SqlDbType.Char, 1), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@UpdateTime", SqlDbType.DateTime), new SqlParameter("@S_TestingPoint_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.GradeTerm; cmdParms[1].Value = model.Subject; cmdParms[2].Value = model.Syllabus; cmdParms[3].Value = model.Test_Category; cmdParms[4].Value = model.TPLevel; cmdParms[5].Value = model.Parent_Id; cmdParms[6].Value = model.S_TestingPointBasic_Id; cmdParms[7].Value = model.TPName; cmdParms[8].Value = model.TPCode; cmdParms[9].Value = model.Importance; cmdParms[10].Value = model.Cognitive_Level; cmdParms[11].Value = model.IsLast; cmdParms[12].Value = model.CreateUser; cmdParms[13].Value = model.CreateTime; cmdParms[14].Value = model.UpdateUser; cmdParms[15].Value = model.UpdateTime; cmdParms[0x10].Value = model.S_TestingPoint_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_S_TestingPoint> DataTableToList(DataTable dt) { List <Model_S_TestingPoint> list = new List <Model_S_TestingPoint>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_S_TestingPoint item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool AddBasic(Model_S_TestingPoint model, Model_S_TestingPointBasic modelBasic) { return(this.dal.AddBasic(model, modelBasic)); }
public bool Update(Model_S_TestingPoint model) { return(this.dal.Update(model)); }
public bool Add(Model_S_TestingPoint model) { return(this.dal.Add(model)); }
protected void btnSave_Click(object sender, EventArgs e) { try { bool flag = false; Model_S_TestingPoint model = new Model_S_TestingPoint(); if (string.IsNullOrEmpty(kpId)) { #region 添加 #region 验证TPCode是否已存在 string strWhereCount = " TPCode='" + txtTPCode.Text.Trim() + "' and GradeTerm='" + GradeTerm + "' and Subject='" + Subject + "' and Syllabus='" + Syllabus + "' and Test_Category='" + Exam_Type + "'"; if (bll.GetRecordCount(strWhereCount) > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('编码已存在。', { time: 2000, icon: 4})</script>"); return; } #endregion if (rbtIsLast0.Checked || (rbtIsLast1.Checked && !string.IsNullOrEmpty(hidTPNameBasic_Id.Value))) { #region 是最后一级 或 是最后一级且基本考点已存在 #region 考点数据表 model.S_TestingPoint_Id = Guid.NewGuid().ToString(); model.GradeTerm = GradeTerm; model.Subject = Subject; model.Syllabus = Syllabus; model.Test_Category = Exam_Type; model.Parent_Id = parentId; model.IsLast = "0"; model.S_TestingPointBasic_Id = ""; model.TPName = txtTPName.Text.Trim(); if (rbtIsLast1.Checked)//是最后一级 { model.IsLast = "1"; model.S_TestingPointBasic_Id = hidTPNameBasic_Id.Value; model.TPName = ""; } if (rbt0.Checked) { model.Importance = "1"; } else { model.Importance = "0"; } model.TPCode = txtTPCode.Text.Trim(); model.TPLevel = ddlKPLevel.SelectedValue; model.Cognitive_Level = ddlCognitive_Level.SelectedValue; model.CreateTime = DateTime.Now; model.CreateUser = loginUser.SysUser_ID; flag = bll.Add(model); #endregion #endregion } else { #region 是最后一级 且 基本考点不存在 #region 基本考点表 Model_S_TestingPointBasic modelBasic = new Model_S_TestingPointBasic(); string S_TestingPointBasic_Id = Guid.NewGuid().ToString(); modelBasic.S_TestingPointBasic_Id = S_TestingPointBasic_Id; modelBasic.GradeTerm = GradeTerm; modelBasic.Subject = Subject; modelBasic.TPNameBasic = hidTPNameBasic.Value.Trim(); modelBasic.CreateTime = DateTime.Now; modelBasic.CreateUser = loginUser.SysUser_ID; #endregion #region 考点数据表 model.S_TestingPoint_Id = Guid.NewGuid().ToString(); model.GradeTerm = GradeTerm; model.Subject = Subject; model.Syllabus = Syllabus; model.Test_Category = Exam_Type; model.Parent_Id = parentId; model.IsLast = "1"; if (rbt0.Checked) { model.Importance = "1"; } else { model.Importance = "0"; } model.S_TestingPointBasic_Id = S_TestingPointBasic_Id; model.TPName = ""; model.TPCode = txtTPCode.Text.Trim(); model.TPLevel = ddlKPLevel.SelectedValue; model.Cognitive_Level = ddlCognitive_Level.SelectedValue; model.CreateTime = DateTime.Now; model.CreateUser = loginUser.SysUser_ID; #endregion flag = bll.AddBasic(model, modelBasic); #endregion } if (flag) { if (parentId == "0") { ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadSubData2('0');parent.layer.close(index)});</script>"); return; } } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增失败!',{ time: 2000,icon:2});</script>"); return; } Rc.Common.SystemLog.SystemLog.AddLogFromBS(loginUser.SysUser_ID, "", "新增同步考点"); #endregion } else { #region 修改 if (rbtIsLast0.Checked || (rbtIsLast1.Checked && !string.IsNullOrEmpty(hidTPNameBasic_Id.Value))) { #region 是最后一级 或 是最后一级且基本考点已存在 #region 考点数据表 model = bll.GetModel(kpId); model.IsLast = "0"; model.S_TestingPointBasic_Id = ""; model.TPName = txtTPName.Text.Trim(); if (rbtIsLast1.Checked)//是最后一级 { model.IsLast = "1"; model.S_TestingPointBasic_Id = hidTPNameBasic_Id.Value; model.TPName = ""; } if (rbt0.Checked) { model.Importance = "1"; } else { model.Importance = "0"; } model.TPCode = txtTPCode.Text.Trim(); model.TPLevel = ddlKPLevel.SelectedValue; model.Cognitive_Level = ddlCognitive_Level.SelectedValue; model.UpdateTime = DateTime.Now; model.UpdateUser = loginUser.SysUser_ID; flag = bll.Update(model); #endregion #endregion } else { #region 是最后一级 且 基本考点不存在 model = bll.GetModel(kpId); #region 基本考点表 Model_S_TestingPointBasic modelBasic = new Model_S_TestingPointBasic(); string S_TestingPointBasic_Id = Guid.NewGuid().ToString(); modelBasic.S_TestingPointBasic_Id = S_TestingPointBasic_Id; modelBasic.GradeTerm = model.GradeTerm; modelBasic.Subject = model.Subject; modelBasic.TPNameBasic = hidTPNameBasic.Value.Trim(); modelBasic.CreateTime = DateTime.Now; modelBasic.CreateUser = loginUser.SysUser_ID; #endregion #region 考点数据表 model.IsLast = "1"; if (rbt0.Checked) { model.Importance = "1"; } else { model.Importance = "0"; } model.S_TestingPointBasic_Id = S_TestingPointBasic_Id; model.TPName = ""; model.TPCode = txtTPCode.Text.Trim(); model.TPLevel = ddlKPLevel.SelectedValue; model.Cognitive_Level = ddlCognitive_Level.SelectedValue; model.UpdateTime = DateTime.Now; model.UpdateUser = loginUser.SysUser_ID; #endregion flag = bll.UpdateBasic(model, modelBasic); #endregion } if (flag) { if (parentId == "0") { ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadSubData2('0');parent.layer.close(index);});</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改失败!',{ time: 2000,icon:2});</script>"); return; } Rc.Common.SystemLog.SystemLog.AddLogFromBS(loginUser.SysUser_ID, "", "修改同步考点"); #endregion } } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function(){layer.msg('操作失败!',{ time: 2000,icon:2});});</script>"); } }
public Model_S_TestingPoint DataRowToModel(DataRow row) { Model_S_TestingPoint point = new Model_S_TestingPoint(); if (row != null) { if (row["S_TestingPoint_Id"] != null) { point.S_TestingPoint_Id = row["S_TestingPoint_Id"].ToString(); } if (row["GradeTerm"] != null) { point.GradeTerm = row["GradeTerm"].ToString(); } if (row["Subject"] != null) { point.Subject = row["Subject"].ToString(); } if (row["Syllabus"] != null) { point.Syllabus = row["Syllabus"].ToString(); } if (row["Test_Category"] != null) { point.Test_Category = row["Test_Category"].ToString(); } if (row["TPLevel"] != null) { point.TPLevel = row["TPLevel"].ToString(); } if (row["Parent_Id"] != null) { point.Parent_Id = row["Parent_Id"].ToString(); } if (row["S_TestingPointBasic_Id"] != null) { point.S_TestingPointBasic_Id = row["S_TestingPointBasic_Id"].ToString(); } if (row["TPName"] != null) { point.TPName = row["TPName"].ToString(); } if (row["TPCode"] != null) { point.TPCode = row["TPCode"].ToString(); } if (row["Importance"] != null) { point.Importance = row["Importance"].ToString(); } if (row["Cognitive_Level"] != null) { point.Cognitive_Level = row["Cognitive_Level"].ToString(); } if (row["IsLast"] != null) { point.IsLast = row["IsLast"].ToString(); } if (row["CreateUser"] != null) { point.CreateUser = row["CreateUser"].ToString(); } if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != "")) { point.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString())); } if (row["UpdateUser"] != null) { point.UpdateUser = row["UpdateUser"].ToString(); } if ((row["UpdateTime"] != null) && (row["UpdateTime"].ToString() != "")) { point.UpdateTime = new DateTime?(DateTime.Parse(row["UpdateTime"].ToString())); } } return(point); }