/// <summary> /// 返回某一数据库中的编号 /// </summary> /// <param name="sysid">主键编号</param> /// <returns></returns> static public int GetNextIDValue(string sysid) { int intPrimary = (int)CMMgr.GetDataTable("SELECT " + sysid + " FROM Sys_FieldID").Rows[0][sysid]; ExecuteNonQuery("UPDATE Sys_FieldID SET " + sysid + "=" + sysid + "+1"); return(intPrimary); }
/// <summary> /// 获取一条Client类信息 /// </summary> /// <param name="ClientID">登录编号</param> /// <returns>一条Client类记录</returns> public Client GetClient(string ClientID) { Client client = new Client(); string strSQL = "SELECT Top 1 * FROM Sys_Client WHERE ClientID = '" + ClientID + "'"; ClassInfoMgr cMgr = new ClassInfoMgr(); SpecMgr sMgr = new SpecMgr(); DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; client.ClientID = row["ClientID"].ToString(); client.ClientName = row["ClientName"].ToString(); client.Password = row["Password"].ToString(); client.Sex = row["Sex"].ToString(); client.ClassInfo = cMgr.GetClassInfo(row["ClassInfoID"].ToString()); client.Spec = sMgr.GetSpec(row["SpecID"].ToString()); client.Tel = row["Tel"].ToString(); client.Mail = row["Mail"].ToString(); client.QQ = row["QQ"].ToString(); return(client); } else { return(client); } }
/// <summary> /// 更新Guide类信息 /// </summary> /// <param name="guide">一级指标管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdateGuide(Guide guide) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (guide != null) { if (guide.GuideID == 0) { strSQL = "SELECT Top 0 * FROM Sys_Guide"; } else { strSQL = "SELECT Top 1 * FROM Sys_Guide WHERE GuideID = " + guide.GuideID.ToString(); } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["GuideCode"] = guide.GuideCode; row["GuideName"] = guide.GuideName; row["Scale"] = guide.Scale; row["Scale1"] = guide.Scale1; row["Scale2"] = guide.Scale2; row["Scale3"] = guide.Scale3; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_Guide", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }
/// <summary> /// 获取一条Rewrite类信息 /// </summary> /// <param name="RewriteID">登录编号</param> /// <returns>一条Rewrite类记录</returns> public Rewrite GetRewrite(string RewriteID) { Rewrite rewrite = new Rewrite(); ClientMgr g2Mgr = new ClientMgr(); PersonMgr pMgr = new PersonMgr(); string strSQL = "SELECT Top 1 * FROM Sys_Rewrite WHERE RewriteID = " + RewriteID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; rewrite.RewriteID = int.Parse(row["RewriteID"].ToString()); rewrite.Title = row["Title"].ToString(); rewrite.Content = row["Content"].ToString(); rewrite.InputDate = DateTime.Parse(row["InputDate"].ToString()); rewrite.Person = pMgr.GetPerson(row["PersonID"].ToString()); rewrite.Client = g2Mgr.GetClient(row["ClientID"].ToString()); rewrite.ReContent = row["ReContent"].ToString(); return(rewrite); } else { return(rewrite); } }
/// <summary> /// 函数 GetAddNumberList | 获取留言信息列表 /// </summary> /// <returns>留言列表</returns> public DataTable GetAddNumberList(string PersonID, string ClientID, string GuideID, string Guide2ID) { string strSQL = @"SELECT * ,(SELECT PersonName FROM Sys_Person WHERE PersonID = Sys_AddNumber.PersonID) AS PersonName ,(SELECT ClientName FROM Sys_Client WHERE ClientID = Sys_AddNumber.ClientID) AS ClientName ,(SELECT Guide2Name FROM Sys_Guide2 WHERE Guide2ID = Sys_AddNumber.Guide2ID) AS Guide2Name ,(SELECT GuideName FROM Sys_Guide WHERE GuideID = Sys_AddNumber.GuideID) AS GuideName FROM Sys_AddNumber WHERE 1=1 "; if (PersonID != "") { strSQL += "AND PersonID = '" + PersonID + "' "; } if (ClientID != "") { strSQL += "AND ClientID = '" + ClientID + "' "; } if (GuideID != "") { strSQL += "AND GuideID = '" + GuideID + "' "; } if (Guide2ID != "") { strSQL += "AND Guide2ID = '" + Guide2ID + "' "; } strSQL += "Order By AddNumberID Desc"; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 获取一条AddNumber类信息 /// </summary> /// <param name="AddNumberID">登录编号</param> /// <returns>一条AddNumber类记录</returns> public AddNumber GetAddNumber(string AddNumberID) { AddNumber addNumber = new AddNumber(); Guide2Mgr g2Mgr = new Guide2Mgr(); GuideMgr gMgr = new GuideMgr(); PersonMgr pMgr = new PersonMgr(); ClientMgr cMgr = new ClientMgr(); string strSQL = "SELECT Top 1 * FROM Sys_AddNumber WHERE AddNumberID = " + AddNumberID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; addNumber.AddNumberID = int.Parse(row["AddNumberID"].ToString()); addNumber.Title = row["Title"].ToString(); addNumber.Content = row["Content"].ToString(); addNumber.IsAudi = row["IsAudi"].ToString(); addNumber.Person = pMgr.GetPerson(row["PersonID"].ToString()); addNumber.Client = cMgr.GetClient(row["ClientID"].ToString()); addNumber.Guide2 = g2Mgr.GetGuide2(row["Guide2ID"].ToString()); addNumber.Guide = gMgr.GetGuide(row["GuideID"].ToString()); addNumber.AddInt = int.Parse(row["AddInt"].ToString()); return(addNumber); } else { return(addNumber); } }
/// <summary> /// 获取一条Asses类信息 /// </summary> /// <param name="AssesID">登录编号</param> /// <returns>一条Asses类记录</returns> public Asses GetAsses(string AssesID) { Asses asses = new Asses(); GuideMgr gMgr = new GuideMgr(); Guide2Mgr g2Mgr = new Guide2Mgr(); PersonMgr pMgr = new PersonMgr(); string strSQL = "SELECT Top 1 * FROM Sys_Asses WHERE AssesID = " + AssesID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; asses.AssesID = int.Parse(row["AssesID"].ToString()); asses.Person = pMgr.GetPerson(row["PersonID"].ToString()); asses.Guide = gMgr.GetGuide(row["GuideID"].ToString()); asses.Guide2 = g2Mgr.GetGuide2(row["Guide2ID"].ToString()); asses.Scale1 = int.Parse(row["Scale1"].ToString()); asses.Scale2 = int.Parse(row["Scale2"].ToString()); asses.Scale3 = int.Parse(row["Scale3"].ToString()); asses.Scale1Name = row["Scale1Name"].ToString(); asses.Scale2Name = row["Scale2Name"].ToString(); asses.Scale3Name = row["Scale3Name"].ToString(); asses.CountNumber = int.Parse(row["CountNumber"].ToString()); asses.Memo = row["Memo"].ToString(); return(asses); } else { return(asses); } }
/// <summary> /// 获取一条Person类信息 /// </summary> /// <param name="PersonID">登录编号</param> /// <returns>一条Person类记录</returns> public Person GetPerson(string PersonID) { Person person = new Person(); string strSQL = "SELECT Top 1 * FROM Sys_Person WHERE PersonID = '" + PersonID + "'"; DataTable dt = CMMgr.GetDataTable(strSQL); ClassInfoMgr cMgr = new ClassInfoMgr(); SpecMgr sMgr = new SpecMgr(); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; person.PersonID = row["PersonID"].ToString(); person.PersonName = row["PersonName"].ToString(); person.Password = row["Password"].ToString(); person.Sex = row["Sex"].ToString(); person.Birthday = row["Birthday"].ToString(); person.ClassInfo = cMgr.GetClassInfo(row["ClassInfoID"].ToString()); person.Spec = sMgr.GetSpec(row["SpecID"].ToString()); return(person); } else { return(person); } }
/// <summary> /// 函数 GetPersonList | 获取学生信息列表 /// </summary> /// <param name="PersonID">登录名称</param> /// <param name="PersonName">真实名称</param> /// <returns>学生列表</returns> public DataTable GetPersonList(string PersonID, string PersonName) { string strSQL = "SELECT *,(SELECT SpecName FROM Sys_Spec WHERE SpecID = Sys_Person.SpecID) AS SpecName,(SELECT ClassInfoName FROM Sys_ClassInfo WHERE ClassInfoID = Sys_Person.ClassInfoID) AS ClassInfoName FROM Sys_Person WHERE " + "PersonName Like '%" + PersonName + "%' " + "AND PersonID Like '%" + PersonID + "%' "; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 更新Spec类信息 /// </summary> /// <param name="spec">专业管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdateSpec(Spec spec) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (spec != null) { if (spec.SpecID == 0) { strSQL = "SELECT Top 0 * FROM Sys_Spec"; } else { strSQL = "SELECT Top 1 * FROM Sys_Spec WHERE SpecID = " + spec.SpecID.ToString(); } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["SpecName"] = spec.SpecName; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_Spec", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }
/// <summary> /// 函数 GetAdminList | 获取管理员信息列表 /// </summary> /// <param name="AdminID">登录名称</param> /// <param name="AdminName">真实名称</param> /// <returns>登录名称列表</returns> public DataTable GetAdminList(string AdminID, string AdminName) { string strSQL = "SELECT * FROM Sys_Admin WHERE " + "AdminID Like '%' + @AdminID + '%' " + "AND AdminName Like '%' + @AdminName + '%' "; SqlParameter[] Parms = new SqlParameter[2]; Parms[0] = new SqlParameter("AdminID", SqlDbType.NVarChar); Parms[0].Value = AdminID; Parms[1] = new SqlParameter("AdminName", SqlDbType.NVarChar); Parms[1].Value = AdminName; return(CMMgr.GetDataTable(strSQL, Parms)); }
/// <summary> /// 函数 GetClientList | 获取教师信息列表 /// </summary> /// <param name="ClientID">登录名称</param> /// <param name="ClientName">真实名称</param> /// <returns>登录名称列表</returns> public DataTable GetClientList(string ClientID, string ClientName) { string strSQL = "SELECT *,(SELECT SpecName FROM Sys_Spec WHERE SpecID = Sys_Client.SpecID) AS SpecName,(SELECT ClassInfoName FROM Sys_ClassInfo WHERE ClassInfoID = Sys_Client.ClassInfoID) AS ClassInfoName FROM Sys_Client WHERE " + "ClientID Like '%' + @ClientID + '%' " + "AND ClientName Like '%' + @ClientName + '%' "; SqlParameter[] Parms = new SqlParameter[2]; Parms[0] = new SqlParameter("ClientID", SqlDbType.NVarChar); Parms[0].Value = ClientID; Parms[1] = new SqlParameter("ClientName", SqlDbType.NVarChar); Parms[1].Value = ClientName; return(CMMgr.GetDataTable(strSQL, Parms)); }
/// <summary> /// 函数 GetPersonList | 获取学生信息列表 /// </summary> /// <param name="PersonID">登录名称</param> /// <param name="PersonName">真实名称</param> /// <returns>学生列表</returns> public DataTable GetPersonList(string PersonID, string PersonName, int SpecID, int ClassInfoID) { string strSQL = "SELECT *,(SELECT SpecName FROM Sys_Spec WHERE SpecID = Sys_Person.SpecID) AS SpecName,(SELECT ClassInfoName FROM Sys_ClassInfo WHERE ClassInfoID = Sys_Person.ClassInfoID) AS ClassInfoName FROM Sys_Person WHERE " + "PersonName Like '%" + PersonName + "%' " + "AND PersonID Like '%" + PersonID + "%' "; if (SpecID != -1) { strSQL += "AND SpecID = " + SpecID.ToString() + " "; } if (ClassInfoID != -1) { strSQL += "AND ClassInfoID = " + ClassInfoID.ToString() + " "; } return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 获取一条Spec类信息 /// </summary> /// <param name="SpecID">登录编号</param> /// <returns>一条Spec类记录</returns> public Spec GetSpec(string SpecID) { Spec spec = new Spec(); string strSQL = "SELECT Top 1 * FROM Sys_Spec WHERE SpecID = " + SpecID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; spec.SpecID = int.Parse(row["SpecID"].ToString()); spec.SpecName = row["SpecName"].ToString(); return(spec); } else { return(spec); } }
/// <summary> /// 获取一条ClassInfo类信息 /// </summary> /// <param name="ClassInfoID">登录编号</param> /// <returns>一条ClassInfo类记录</returns> public ClassInfo GetClassInfo(string ClassInfoID) { ClassInfo classInfo = new ClassInfo(); string strSQL = "SELECT Top 1 * FROM Sys_ClassInfo WHERE ClassInfoID = " + ClassInfoID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; classInfo.ClassInfoID = int.Parse(row["ClassInfoID"].ToString()); classInfo.ClassInfoName = row["ClassInfoName"].ToString(); return(classInfo); } else { return(classInfo); } }
/// <summary> /// 函数ExistsPerson | 判断一个学生登录帐号是否存在 /// </summary> /// <param name="PersonID">学生帐号</param> /// <returns>存在返回true不存在返回false</returns> public bool ExistsPerson(string PersonID) { ArrayList arList = new ArrayList(); SqlParameter Param = null; string strSQL = "SELECT Top 1 PersonID FROM Sys_Person WHERE PersonID = @PersonID"; Param = new SqlParameter("PersonID", SqlDbType.NVarChar); Param.Value = PersonID; arList.Add(Param); if (CMMgr.GetDataTable(strSQL, arList).Rows.Count == 0) { return(false); } else { return(true); } }
/// <summary> /// 函数 GetAssesList | 获取评定指标信息列表 /// </summary> /// <returns>评定指标列表</returns> public DataTable GetAssesNumberList(string PersonID, int GuideID) { string strSQL = @"SELECT * ,(SELECT GuideName FROM Sys_Guide WHERE GuideID = Sys_Asses.GuideID) AS GuideName ,(SELECT Guide2Name FROM Sys_Guide2 WHERE Guide2ID = Sys_Asses.Guide2ID) AS Guide2Name ,(SELECT PersonName FROM Sys_Person WHERE PersonID = Sys_Asses.PersonID) AS PersonName ,(SELECT Sex FROM Sys_Person WHERE PersonID = Sys_Asses.PersonID) AS Sex ,(SELECT Top 1 ClassInfoName FROM Sys_ClassInfo WHERE ClassInfoID IN (SELECT ClassInfoID FROM Sys_Asses WHERE PersonID = Sys_Asses.PersonID)) AS ClassInfoName ,(SELECT Top 1 SpecName FROM Sys_Spec WHERE SpecID IN (SELECT SpecID FROM Sys_Asses WHERE PersonID = Sys_Asses.PersonID)) AS SpecName FROM Sys_Asses WHERE PersonID = '" + PersonID + "' "; if (GuideID != -1) { strSQL += "AND GuideID = " + GuideID.ToString() + " "; } return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 获取一条Guide2类信息 /// </summary> /// <param name="Guide2ID">登录编号</param> /// <returns>一条Guide2类记录</returns> public Guide2 GetGuide2(string Guide2ID) { Guide2 guide2 = new Guide2(); GuideMgr gMgr = new GuideMgr(); string strSQL = "SELECT Top 1 * FROM Sys_Guide2 WHERE Guide2ID = " + Guide2ID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; guide2.Guide2ID = int.Parse(row["Guide2ID"].ToString()); guide2.Guide2Name = row["Guide2Name"].ToString(); guide2.Guide = gMgr.GetGuide(row["GuideID"].ToString()); return(guide2); } else { return(guide2); } }
/// <summary> /// 获取一条Admin类信息 /// </summary> /// <param name="AdminID">登录编号</param> /// <returns>一条Admin类记录</returns> public Admin GetAdmin(string AdminID) { Admin admin = new Admin(); string strSQL = "SELECT Top 1 * FROM Sys_Admin WHERE AdminID = '" + AdminID + "'"; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; admin.AdminID = row["AdminID"].ToString(); admin.AdminName = row["AdminName"].ToString(); admin.Tel = row["Tel"].ToString(); admin.Mail = row["Mail"].ToString(); admin.QQ = row["QQ"].ToString(); admin.Password = row["Password"].ToString(); return(admin); } else { return(admin); } }
/// <summary> /// 函数 GetRewriteList | 获取留言信息列表 /// </summary> /// <returns>留言列表</returns> public DataTable GetRewriteList(string PersonID, string ClientID) { string strSQL = @"SELECT * ,(SELECT PersonName FROM Sys_Person WHERE PersonID = Sys_Rewrite.PersonID) AS PersonName ,(SELECT ClientName FROM Sys_Client WHERE ClientID = Sys_Rewrite.ClientID) AS ClientName FROM Sys_Rewrite WHERE 1=1 "; if (PersonID != "") { strSQL += "AND PersonID = '" + PersonID + @"' "; } if (ClientID != "") { strSQL += "AND ClientID = '" + ClientID + @"' "; } strSQL += "Order By RewriteID Desc"; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 获取一条Guide类信息 /// </summary> /// <param name="GuideID">登录编号</param> /// <returns>一条Guide类记录</returns> public Guide GetGuide(string GuideID) { Guide guide = new Guide(); string strSQL = "SELECT Top 1 * FROM Sys_Guide WHERE GuideID = " + GuideID; DataTable dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; guide.GuideID = int.Parse(row["GuideID"].ToString()); guide.GuideCode = row["GuideCode"].ToString(); guide.GuideName = row["GuideName"].ToString(); guide.Scale = int.Parse(row["Scale"].ToString()); guide.Scale1 = int.Parse(row["Scale1"].ToString()); guide.Scale2 = int.Parse(row["Scale2"].ToString()); guide.Scale3 = int.Parse(row["Scale3"].ToString()); return(guide); } else { return(guide); } }
/// <summary> /// 函数 GetAssesList | 获取评定指标信息列表 /// </summary> /// <returns>评定指标列表</returns> public DataTable GetAssesList(string PersonID, string PersonName, int SpecID) { string strSQL = @"SELECT * ,(SELECT GuideName FROM Sys_Guide WHERE GuideID = Sys_Asses.GuideID) AS GuideName ,(SELECT Guide2Name FROM Sys_Guide2 WHERE Guide2ID = Sys_Asses.Guide2ID) AS Guide2Name ,(SELECT PersonName FROM Sys_Person WHERE PersonID = Sys_Asses.PersonID) AS PersonName ,(SELECT Sex FROM Sys_Person WHERE PersonID = Sys_Asses.PersonID) AS Sex ,(SELECT Top 1 ClassInfoName FROM Sys_ClassInfo WHERE ClassInfoID IN (SELECT ClassInfoID FROM Sys_Asses WHERE PersonID = Sys_Asses.PersonID)) AS ClassInfoName ,(SELECT Top 1 SpecName FROM Sys_Spec WHERE SpecID IN (SELECT SpecID FROM Sys_Asses WHERE PersonID = Sys_Asses.PersonID)) AS SpecName FROM Sys_Asses WHERE PersonID IN (SELECT PersonID FROM Sys_Person WHERE PersonID Like '%" + PersonID + "%' AND PersonName Like '%" + PersonName + "%') "; if (SpecID != -1) { strSQL += "AND PersonID IN (SELECT PersonID FROM Sys_Person WHERE SpecID = " + SpecID.ToString() + ") "; } strSQL += "Order By CountNumber Desc"; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 函数 GetGuideList | 获取一级指标信息列表 /// </summary> /// <param name="GuideID">登录名称</param> /// <param name="GuideName">真实名称</param> /// <returns>一级指标列表</returns> public DataTable GetGuideList() { string strSQL = "SELECT * FROM Sys_Guide Order By GuideID Desc"; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 更新Client类信息 /// </summary> /// <param name="client">教师管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdateClient(Client client) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (client != null) { if (client.ClientID == "") { strSQL = "SELECT Top 0 * FROM Sys_Client"; } else { strSQL = "SELECT Top 1 * FROM Sys_Client WHERE ClientID = '" + client.ClientID + "'"; } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["ClientID"] = client.ClientID; row["ClientName"] = client.ClientName; row["Password"] = client.Password; row["Sex"] = client.Sex; row["ClassInfoID"] = client.ClassInfo.ClassInfoID; row["SpecID"] = client.Spec.SpecID; row["Tel"] = client.Tel; row["Mail"] = client.Mail; row["QQ"] = client.QQ; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_Client", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }
/// <summary> /// 函数 GetClassInfoList | 获取班级信息列表 /// </summary> /// <param name="ClassInfoID">登录名称</param> /// <param name="ClassInfoName">真实名称</param> /// <returns>班级列表</returns> public DataTable GetClassInfoList() { string strSQL = "SELECT * FROM Sys_ClassInfo Order By ClassInfoID Desc"; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 更新AddNumber类信息 /// </summary> /// <param name="addNumber">留言管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdateAddNumber(AddNumber addNumber) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (addNumber != null) { if (addNumber.AddNumberID == 0) { strSQL = "SELECT Top 0 * FROM Sys_AddNumber"; } else { strSQL = "SELECT Top 1 * FROM Sys_AddNumber WHERE AddNumberID = " + addNumber.AddNumberID.ToString(); } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["Title"] = addNumber.Title; row["Content"] = addNumber.Content; row["IsAudi"] = addNumber.IsAudi; row["PersonID"] = addNumber.Person.PersonID; row["ClientID"] = addNumber.Client.ClientID; row["Guide2ID"] = addNumber.Guide2.Guide2ID; row["GuideID"] = addNumber.Guide.GuideID; row["AddInt"] = addNumber.AddInt; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_AddNumber", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }
/// <summary> /// 更新Person类信息 /// </summary> /// <param name="person">学生管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdatePerson(Person person) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (person != null) { if (person.PersonID == "") { strSQL = "SELECT Top 0 * FROM Sys_Person"; } else { strSQL = "SELECT Top 1 * FROM Sys_Person WHERE PersonID = '" + person.PersonID + "'"; } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["PersonID"] = person.PersonID; row["PersonName"] = person.PersonName; row["Password"] = person.Password; row["Sex"] = person.Sex; row["Birthday"] = person.Birthday; row["ClassInfoID"] = person.ClassInfo.ClassInfoID; row["SpecID"] = person.Spec.SpecID; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_Person", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }
/// <summary> /// 函数 GetSpecList | 获取专业信息列表 /// </summary> /// <param name="SpecID">登录名称</param> /// <param name="SpecName">真实名称</param> /// <returns>专业列表</returns> public DataTable GetSpecList() { string strSQL = "SELECT * FROM Sys_Spec Order By SpecID Desc"; return(CMMgr.GetDataTable(strSQL)); }
/// <summary> /// 更新Rewrite类信息 /// </summary> /// <param name="rewrite">留言管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdateRewrite(Rewrite rewrite) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (rewrite != null) { if (rewrite.RewriteID == 0) { strSQL = "SELECT Top 0 * FROM Sys_Rewrite"; } else { strSQL = "SELECT Top 1 * FROM Sys_Rewrite WHERE RewriteID = " + rewrite.RewriteID.ToString(); } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["Title"] = rewrite.Title; row["Content"] = rewrite.Content; row["InputDate"] = rewrite.InputDate; row["PersonID"] = rewrite.Person.PersonID; row["ClientID"] = rewrite.Client.ClientID; row["ReContent"] = rewrite.ReContent; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_Rewrite", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }
/// <summary> /// 更新Asses类信息 /// </summary> /// <param name="asses">评定指标管理类参数</param> /// <returns>更新成功返回true 否则返回false</returns> public bool UpdateAsses(Asses asses) { string strSQL = ""; SqlDataAdapter sa = null; SqlCommandBuilder builder = null; DataRow row = null; DataTable dt = null; bool returnValue = false; if (asses != null) { if (asses.AssesID == 0) { strSQL = "SELECT Top 0 * FROM Sys_Asses"; } else { strSQL = "SELECT Top 1 * FROM Sys_Asses WHERE AssesID = " + asses.AssesID.ToString(); } dt = CMMgr.GetDataTable(strSQL); if (dt.Rows.Count > 0) { row = dt.Rows[0]; } else { row = dt.NewRow(); } row["PersonID"] = asses.Person.PersonID; row["GuideID"] = asses.Guide.GuideID; row["Guide2ID"] = asses.Guide2.Guide2ID; row["Scale1"] = asses.Scale1; row["Scale2"] = asses.Scale2; row["Scale3"] = asses.Scale3; row["Scale1Name"] = asses.Scale1Name; row["Scale2Name"] = asses.Scale2Name; row["Scale3Name"] = asses.Scale3Name; row["CountNumber"] = asses.CountNumber; row["Memo"] = asses.Memo; if (dt.Rows.Count == 0) { dt.Rows.Add(row); } SqlConnection conn = CMMgr.GetConnection(); using (sa = new SqlDataAdapter("SELECT Top 0 * FROM Sys_Asses", conn)) { try { builder = new SqlCommandBuilder(sa); sa.Update(dt); returnValue = true; } finally { conn.Close(); conn.Dispose(); } } } return(returnValue); }