public static void AddMember(Dal.Models.GroupMember member, OleDbConnection conn, OleDbTransaction trans = null) { if (member == null || member.GroupID == null || member.ExpertID == null) { throw new Exception("参数错误!"); } if (string.IsNullOrEmpty(member.Grade)) { member.Grade = "1203"; } if (string.IsNullOrEmpty(member.Duty)) { member.Duty = "1302"; } if (IsExpertInGroup(member.GroupID.Value, member.ExpertID.Value, conn, trans)) { throw new Exception("专家已在本专家组!"); } StringBuilder sbSql = new StringBuilder(); sbSql.Append(" INSERT INTO GroupMember( "); sbSql.Append(" GroupID "); sbSql.Append(" , ExpertID "); sbSql.Append(" , Grade "); sbSql.Append(" , Duty "); sbSql.Append(" , Ordinal "); sbSql.Append(" ) VALUES (?, ?, ?, ?, ?) "); Dal.OleDbHlper.ExecuteNonQuery(sbSql.ToString(), conn, CommandType.Text, trans , new OleDbParameter("@GroupID", OleDbType.Integer) { Value = member.GroupID } , new OleDbParameter("@ExpertID", OleDbType.Integer) { Value = member.ExpertID } , new OleDbParameter("@Grade", OleDbType.VarWChar) { Value = member.Grade } , new OleDbParameter("@Duty", OleDbType.VarWChar) { Value = member.Duty } , new OleDbParameter("@Ordinal", OleDbType.Integer) { Value = member.Ordinal }); }
public void AddExpertGroupMember(HttpContext context, OleDbConnection conn) { int id = Convert.ToInt32(context.Request["GroupID"]); string ExpertId = context.Request["ExpertID"]; if (ExpertId != null) { Dal.Models.GroupMember expertGroupMember = new Dal.Models.GroupMember(); expertGroupMember.GroupID = id; expertGroupMember.ExpertID = Convert.ToInt32(ExpertId); expertGroupMember.Duty = ""; expertGroupMember.Grade = ""; BLL.ExpertGroup.AddMember(expertGroupMember, conn); } List <Dal.Models.GroupMember> lstExpertGroupMember = BLL.ExpertGroup.GetGroupMemberList(id, conn); context.Response.Write(JsonConvert.SerializeObject(lstExpertGroupMember)); }