Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SchSystem.Model.SchStuGenUn model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SchStuGenUn(");
            strSql.Append("StuId,GenId,Relation)");
            strSql.Append(" values (");
            strSql.Append("@StuId,@GenId,@Relation)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@StuId",    SqlDbType.Int,      4),
                new SqlParameter("@GenId",    SqlDbType.Int,      4),
                new SqlParameter("@Relation", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.StuId;
            parameters[1].Value = model.GenId;
            parameters[2].Value = model.Relation;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SchSystem.Model.SchStuGenUn model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SchStuGenUn set ");
            strSql.Append("StuId=@StuId,");
            strSql.Append("GenId=@GenId,");
            strSql.Append("Relation=@Relation");
            strSql.Append(" where UnId=@UnId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@StuId",    SqlDbType.Int,       4),
                new SqlParameter("@GenId",    SqlDbType.Int,       4),
                new SqlParameter("@Relation", SqlDbType.NVarChar, 50),
                new SqlParameter("@UnId",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.StuId;
            parameters[1].Value = model.GenId;
            parameters[2].Value = model.Relation;
            parameters[3].Value = model.UnId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public CommandInfo UpdateStuGen(SchSystem.Model.SchStuGenUn model)
        {
            CommandInfo   cf     = new CommandInfo();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SchStuGenUn set ");
            strSql.Append("StuId=@StuId,");
            strSql.Append("GenId=@GenId,");
            strSql.Append("Relation=@Relation,");
            strSql.Append("GenName=@GenName");
            strSql.Append(" where UnId=@UnId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@StuId",    SqlDbType.Int,       4),
                new SqlParameter("@GenId",    SqlDbType.Int,       4),
                new SqlParameter("@Relation", SqlDbType.NVarChar, 50),
                new SqlParameter("@GenName",  SqlDbType.NVarChar, 50),
                new SqlParameter("@UnId",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.StuId;
            parameters[1].Value = model.GenId;
            parameters[2].Value = model.Relation;
            parameters[3].Value = model.GenName;
            parameters[4].Value = model.UnId;

            cf.CommandText = strSql.ToString();
            cf.Parameters  = parameters;
            return(cf);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public CommandInfo AddStuGen(SchSystem.Model.SchStuGenUn model)
        {
            CommandInfo   cf     = new CommandInfo();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SchStuGenUn(");
            strSql.Append("StuId,GenId,Relation,GenName)");
            strSql.Append(" values (");
            strSql.Append("@StuId,@GenId,@Relation,@GenName)");
            strSql.Append(";select @@IDENTITY");
            cf.CommandText = strSql.ToString();
            SqlParameter[] parameters =
            {
                new SqlParameter("@StuId",    SqlDbType.Int,       4),
                new SqlParameter("@GenId",    SqlDbType.Int,       4),
                new SqlParameter("@Relation", SqlDbType.NVarChar, 50),
                new SqlParameter("@GenName",  SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.StuId;
            parameters[1].Value = model.GenId;
            parameters[2].Value = model.Relation;
            parameters[3].Value = model.GenName;
            cf.Parameters       = parameters;
            return(cf);
        }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SchSystem.Model.SchStuGenUn DataRowToModel(DataRow row)
 {
     SchSystem.Model.SchStuGenUn model = new SchSystem.Model.SchStuGenUn();
     if (row != null)
     {
         if (row["UnId"] != null && row["UnId"].ToString() != "")
         {
             model.UnId = int.Parse(row["UnId"].ToString());
         }
         if (row["StuId"] != null && row["StuId"].ToString() != "")
         {
             model.StuId = int.Parse(row["StuId"].ToString());
         }
         if (row["GenId"] != null && row["GenId"].ToString() != "")
         {
             model.GenId = int.Parse(row["GenId"].ToString());
         }
         if (row["Relation"] != null)
         {
             model.Relation = row["Relation"].ToString();
         }
     }
     return(model);
 }
Example #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SchSystem.Model.SchStuGenUn GetModel(int UnId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UnId,StuId,GenId,Relation from SchStuGenUn ");
            strSql.Append(" where UnId=@UnId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UnId", SqlDbType.Int, 4)
            };
            parameters[0].Value = UnId;

            SchSystem.Model.SchStuGenUn model = new SchSystem.Model.SchStuGenUn();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #7
0
        public static string schsave(string Genid1, string Genid2, string Unid1, string Unid2, string Stuid, string dotype, string schid, string ClassId, string TestNo, string StuName, string Sex, string CardNo, string StudyType, string TelNo, string LoginName, string Pwd, string Addr, string Stat, string jzGenName1, string jzTelNo1, string jzLoginName1, string jzPwd1, string jzStat1, string jzGenName2, string jzTelNo2, string jzLoginName2, string jzPwd2, string jzStat2, string Relation1, string Relation2, string OldClassName, string OldGradeId, string OldGradeName, string GradeId, string OldClassId, string CurrentTestNo)
        {
            string result = ""; //事物返回结果

            SchSystem.BLL.SchClassUser bllclassuser          = new SchSystem.BLL.SchClassUser();
            Com.DataPack.DataRsp <Com.DataPack.UserInfo> rsp = Com.Public.UserFuncSoure(Com.SoureSession.jsid, Com.SoureSession.jstoken);
            if (rsp.code == "ERROR_TOKEN")
            {
                result = "expire";
            }
            else
            {
                List <string> LstError = new List <string>();
                try
                {
                    //if (!Com.Public.isVa(schid, ""))
                    //{
                    //    LstError.Add("无跨界权限!" + Environment.NewLine);
                    //}
                    SchSystem.Model.SchStuInfo model_stu = new SchSystem.Model.SchStuInfo();
                    SchSystem.BLL.SchStuInfo   bll_stu   = new SchSystem.BLL.SchStuInfo();
                    #region 收集学生信息
                    if (Com.SoureSession.Souresystype != "2")
                    {
                        model_stu.SchId = Convert.ToInt32(Com.SoureSession.Soureschid);
                    }
                    else
                    {
                        model_stu.SchId = Convert.ToInt32(schid);
                    }

                    StringBuilder sb = new StringBuilder();
                    if (GradeId != OldGradeId)
                    {
                        sb.Append(OldGradeName);
                    }
                    if (ClassId != OldClassId)
                    {
                        sb.Append(OldClassName);
                    }
                    string sbstr = sb.ToString();
                    if (sbstr != "")
                    {
                        model_stu.OldClassId = sbstr;
                    }
                    else
                    {
                        model_stu.OldClassId = "";
                    }
                    model_stu.ClassId = Convert.ToInt32(ClassId);

                    /*
                     * if (ClassId != OldClassIdstr)//如果班级ID有变化说明是在调班
                     * {
                     *  if (OldClassIdSavestr == "")//如果是第一次调班
                     *  {
                     *      model_stu.OldClassId = OldClassIdstr;
                     *  }
                     *  else//曾经调过班
                     *  {
                     *      StringBuilder sb = new StringBuilder();
                     *      sb.Append(OldClassIdSavestr + "," + OldClassIdstr);//班级ID以英文半角的逗号隔开
                     *      model_stu.OldClassId = sb.ToString() ;
                     *  }
                     *  model_stu.ClassId = Convert.ToInt32(ClassId);
                     * }
                     * else//否则,没有调班
                     * {
                     *  model_stu.ClassId = Convert.ToInt32(ClassId);
                     * }
                     */
                    model_stu.TestNo    = Com.Public.SqlEncStr(TestNo);
                    model_stu.StuName   = Com.Public.SqlEncStr(StuName);
                    model_stu.Sex       = Convert.ToInt32(Sex);
                    model_stu.Dutie     = "";
                    model_stu.StudyType = Convert.ToInt32(StudyType);
                    model_stu.TelNo     = Com.Public.SqlEncStr(TelNo);
                    model_stu.LoginName = Com.Public.SqlEncStr(LoginName);
                    if (Pwd != "")
                    {
                        model_stu.Pwd = Com.Public.StrToMD5(Com.Public.SqlEncStr(Pwd));
                    }
                    else
                    {
                        model_stu.Pwd = "";
                    }
                    model_stu.Addr        = Com.Public.SqlEncStr(Addr);
                    model_stu.Stat        = Convert.ToInt32(Stat);
                    model_stu.Birth       = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.RecUser     = Com.SoureSession.Soureuserid;
                    model_stu.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.LastRecUser = Com.SoureSession.Soureuserid;
                    model_stu.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.StuNo       = Com.Public.SqlEncStr(TestNo);
                    model_stu.CardNo      = "";   //(Test)卡地址在前台读取,
                    model_stu.ImgUrl      = "00"; //(Test)学生默认头像
                    if (dotype == "e")
                    {
                        model_stu.StuId = Convert.ToInt32(Stuid);
                    }
                    #endregion
                    #region 收集家长信息
                    List <SchSystem.Model.SchGenInfo> list_model_gen = new List <SchSystem.Model.SchGenInfo>();
                    SchSystem.Model.SchGenInfo        model_gen      = new SchSystem.Model.SchGenInfo();
                    //if (Convert.ToString(jzGenName1) != "" && Convert.ToString(jzTelNo1) != "")
                    //{
                    model_gen.GenName   = Com.Public.SqlEncStr(jzGenName1);
                    model_gen.TelNo     = Com.Public.SqlEncStr(jzTelNo1);
                    model_gen.LoginName = "";

                    if (Pwd != "")
                    {
                        model_gen.Pwd = Com.Public.StrToMD5(Com.Public.SqlEncStr(jzPwd1));
                    }
                    else
                    {
                        model_gen.Pwd = "";
                    }
                    model_gen.Stat        = Convert.ToInt32(jzStat1);
                    model_gen.RecUser     = Com.SoureSession.Soureuserid;
                    model_gen.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen.LastRecUser = Com.SoureSession.Soureuserid;
                    model_gen.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen.ImgUrl      = "00";//(Test)学生默认头像
                    model_gen.Sex         = 1;
                    if (Genid1 != "")
                    {
                        if (dotype == "e")
                        {
                            model_gen.GenId = Convert.ToInt32(Genid1);
                        }
                    }
                    list_model_gen.Add(model_gen);
                    //}

                    SchSystem.Model.SchGenInfo model_gen2 = new SchSystem.Model.SchGenInfo();
                    //if (Convert.ToString(jzGenName2) != "" && Convert.ToString(jzTelNo2) != "")
                    //{
                    model_gen2.GenName   = Com.Public.SqlEncStr(jzGenName2);
                    model_gen2.TelNo     = Com.Public.SqlEncStr(jzTelNo2);
                    model_gen2.LoginName = "";
                    if (Pwd != "")
                    {
                        model_gen2.Pwd = Com.Public.StrToMD5(Convert.ToString(jzPwd2));
                    }
                    else
                    {
                        model_gen2.Pwd = "";
                    }
                    model_gen2.Stat        = Convert.ToInt32(jzStat2);
                    model_gen2.RecUser     = Com.SoureSession.Soureuserid;
                    model_gen2.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen2.LastRecUser = Com.SoureSession.Soureuserid;
                    model_gen2.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_gen2.ImgUrl      = "00";//(Test)学生默认头像
                    model_gen2.Sex         = 1;
                    if (dotype == "e")
                    {
                        if (Genid2 == "")//编辑时,如果家长ID为空,则添加
                        {
                            model_gen2.GenId = 0;
                        }
                        else
                        {
                            model_gen2.GenId = Convert.ToInt32(Genid2);
                        }
                    }
                    list_model_gen.Add(model_gen2);
                    //}

                    #endregion
                    #region 收集学生家长关系信息
                    List <SchSystem.Model.SchStuGenUn> list_model_stu_gen = new List <SchSystem.Model.SchStuGenUn>();
                    SchSystem.Model.SchStuGenUn        model_stu_gen      = new SchSystem.Model.SchStuGenUn();
                    model_stu_gen.Relation = Com.Public.SqlEncStr(Relation1);
                    model_stu_gen.GenName  = Com.Public.SqlEncStr(jzGenName1);
                    if (dotype == "e")
                    {
                        if (Unid1 != "")
                        {
                            model_stu_gen.UnId = Convert.ToInt32(Unid1);
                        }
                        else
                        {
                            model_stu_gen.UnId = 0;
                        }
                        model_stu_gen.StuId = model_stu.StuId;
                        model_stu_gen.GenId = model_gen.GenId;
                    }
                    list_model_stu_gen.Add(model_stu_gen);


                    SchSystem.Model.SchStuGenUn model_stu_gen2 = new SchSystem.Model.SchStuGenUn();
                    if (Convert.ToString(Relation2) != "")
                    {
                        model_stu_gen2.Relation = Com.Public.SqlEncStr(Relation2);
                        model_stu_gen2.GenName  = Com.Public.SqlEncStr(jzGenName2);
                        if (dotype == "e")
                        {
                            if (model_gen2.GenId != 0)
                            {
                                model_stu_gen2.UnId  = Convert.ToInt32(Unid2);
                                model_stu_gen2.StuId = model_stu.StuId;
                                model_stu_gen2.GenId = model_gen2.GenId;
                            }
                            else
                            {
                                model_stu_gen2.UnId = 0;
                            }
                        }
                        list_model_stu_gen.Add(model_stu_gen2);
                    }


                    #endregion
                    if (dotype == "a")//操作类型为添加
                    {
                        if (bll_stu.ExistsStuCode(0, model_stu.TestNo.ToString(), Convert.ToInt32(model_stu.SchId)))
                        {
                            /*
                             * LstError.Add("学(考)号重复 !" + Environment.NewLine);//学(考)号重复
                             * result = "KHCF";*/
                            StringBuilder            sbExists = new StringBuilder();
                            string                   utname   = "";
                            SchSystem.BLL.SchStuInfo ssiBll   = new SchSystem.BLL.SchStuInfo();
                            if (schid == "0")
                            {
                                schid = model_stu.SchId.ToString();
                            }
                            DataTable dt = ssiBll.ExistsStuNo(TestNo, int.Parse(schid)).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                DataRow[] dr = dt.Select();
                                foreach (DataRow item in dr)
                                {
                                    sbExists.Append(item["StuName"].ToString() + "[" + item["GradeName"].ToString());
                                    sbExists.Append("(" + item["ClassName"].ToString() + ")]");
                                }
                                //ret += "账号重复!";
                                return(result = sbExists.ToString());
                            }
                        }
                        if (LoginName != "")
                        {
                            if (bll_stu.ExistsStuUsername(0, model_stu.LoginName.ToString(), Convert.ToInt32(model_stu.SchId)))
                            {
                                LstError.Add("账号重复 !" + Environment.NewLine);//账号重复
                                result = "ZHCF";
                            }
                        }
                        if (LstError.Count == 0)
                        {
                            if (Com.SoureSession.Souresystype == "1" || Com.SoureSession.Souresystype == "2")//超管和学校超管
                            {
                                result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                            }
                            else
                            {
                                //if (ClassId == classidstr)
                                //{
                                if (bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.SoureSession.Soureusertid, Com.SoureSession.Soureschid, 1) == true)//班主任
                                {
                                    result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                                }
                                else
                                {
                                    result = "BBBZR";
                                }
                                //}
                                //else if (GradeId == gradecodestr)
                                //{
                                //    if (bll_stu.ExistsGrade(Com.Public.SqlEncStr(GradeId), Com.Session.schid, Com.Session.usertid) == true)//年级主任
                                //    {
                                //        result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                                //    }
                                //    else
                                //    {
                                //        result = "BNJZR";
                                //    }
                                //}
                            }
                            //result = bll_stu.Add(model_stu, list_model_gen, list_model_stu_gen);
                        }
                    }
                    else if (dotype == "e")//操作类型为编辑
                    {
                        StringBuilder            sbExists = new StringBuilder();
                        string                   utname   = "";
                        SchSystem.BLL.SchStuInfo ssiBll   = new SchSystem.BLL.SchStuInfo();
                        if (schid == "0")
                        {
                            schid = model_stu.SchId.ToString();
                        }
                        DataTable dt = ssiBll.ExistsStuNoUpdate(TestNo, int.Parse(schid), CurrentTestNo).Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            DataRow[] dr = dt.Select();
                            foreach (DataRow item in dr)
                            {
                                sbExists.Append(item["StuName"].ToString() + "[" + item["GradeName"].ToString());
                                sbExists.Append("(" + item["ClassName"].ToString() + ")]");
                            }
                            //ret += "账号重复!";
                            return(result = sbExists.ToString());
                        }
                        //if (bll_stu.ExistsStuCode(0, model_stu.TestNo.ToString(), Convert.ToInt32(model_stu.SchId)))
                        //{
                        //    LstError.Add("学(考)号重复 !" + Environment.NewLine);//学(考)号重复
                        //    result = "KHCF";
                        //}
                        if (LstError.Count == 0)
                        {
                            result = bll_stu.Update(model_stu, list_model_gen, list_model_stu_gen);
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(result);
        }
        public static Com.DataPack.DataRsp <string> schsave(string Stuid, string dotype, string schid, string ClassId, string TestNo, string StuName, string Sex, string CardNo, string StudyType, string TelNo, string Addr, string jzGenName1, string jzTelNo1, string jzGenName2, string jzTelNo2, string Relation1, string Relation2, string OldClassName, string OldGradeId, string OldGradeName, string GradeId, string OldClassId, string CurrentTestNo)
        {
            Com.DataPack.DataRsp <string> rsp          = new Com.DataPack.DataRsp <string>();
            SchSystem.BLL.SchClassUser    bllclassuser = new SchSystem.BLL.SchClassUser();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "页面已经过期,请重新登录";
            }
            else
            {
                try
                {
                    SchSystem.Model.SchStuInfo model_stu = new SchSystem.Model.SchStuInfo();
                    SchSystem.BLL.SchStuInfo   bll_stu   = new SchSystem.BLL.SchStuInfo();
                    if (Com.Session.systype != "2")
                    {
                        model_stu.SchId = Convert.ToInt32(Com.Session.schid);
                    }
                    else
                    {
                        model_stu.SchId = Convert.ToInt32(schid);
                    }

                    StringBuilder sb = new StringBuilder();
                    if (ClassId != OldClassId)
                    {
                        sb.Append(OldGradeName + "(" + OldClassName + ")");
                    }
                    string sbstr = sb.ToString();
                    if (sbstr != "")
                    {
                        model_stu.OldClassId = sbstr;
                    }
                    else
                    {
                        model_stu.OldClassId = "";
                    }
                    model_stu.ClassId     = Convert.ToInt32(ClassId);
                    model_stu.TestNo      = Com.Public.SqlEncStr(TestNo);
                    model_stu.StuName     = Com.Public.SqlEncStr(StuName);
                    model_stu.Sex         = Convert.ToInt32(Sex);
                    model_stu.StudyType   = Convert.ToInt32(StudyType);
                    model_stu.TelNo       = Com.Public.SqlEncStr(TelNo);
                    model_stu.Addr        = Com.Public.SqlEncStr(Addr);
                    model_stu.RecUser     = Com.Session.userid;
                    model_stu.RecTime     = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.LastRecUser = Com.Session.userid;
                    model_stu.LastRecTime = Convert.ToDateTime(DateTime.Now.ToLocalTime().ToString());
                    model_stu.StuNo       = Com.Public.SqlEncStr(TestNo);
                    model_stu.CardNo      = "";//(Test)卡地址在前台读取,
                    string errorstr = "";
                    //获取有考号的学生列表,进行添加或者修改判断
                    int stuids = 0;
                    if (dotype == "e")//根据是否有判断
                    {
                        model_stu.StuId = Convert.ToInt32(Stuid);
                        stuids          = model_stu.StuId;
                    }
                    //判断是否有该学号的学生
                    StringBuilder            sbExists = new StringBuilder();
                    SchSystem.BLL.SchStuInfo ssiBll   = new SchSystem.BLL.SchStuInfo();
                    //看是否考号被占用
                    DataTable dt = ssiBll.GetStuNoList(TestNo, model_stu.SchId, stuids).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        DataRow[] dr = dt.Select();
                        foreach (DataRow item in dr)
                        {
                            sbExists.Append("[" + item["GradeName"].ToString() + item["ClassName"].ToString() + "]" + item["StuName"].ToString() + ";");
                        }
                        errorstr += "考号被:" + sbExists.ToString() + "占用;";
                    }
                    if (Com.Session.systype == "0" && !bllclassuser.ExistsIsMs(Com.Public.SqlEncStr(ClassId), Com.Session.usertid, Com.Session.schid, 1) == true)//班主任
                    {
                        errorstr += "非班主任不能添加学生!";
                    }
                    if (errorstr == "")
                    {
                        if (dotype == "e")
                        {
                            //更新学生
                            bll_stu.UpdateStu(model_stu);
                        }
                        else
                        {
                            stuids = bll_stu.AddStu(model_stu);
                        }
                        if (stuids > 0)
                        {
                            //添加家长
                            //先删除关联表数据
                            SchSystem.BLL.SchStuGenUn genunBll = new SchSystem.BLL.SchStuGenUn();
                            genunBll.DeleteStuUn(stuids);
                            SchSystem.BLL.SchGenInfo genBll = new SchSystem.BLL.SchGenInfo();
                            //对第一个家长资料进行处理
                            if (Convert.ToString(jzGenName1) != "" && Convert.ToString(jzTelNo1) != "")
                            {
                                int genid = genBll.GetMbId(jzTelNo1);
                                if (genid == 0)//无号码存在,则插数据
                                {
                                    SchSystem.Model.SchGenInfo genmodel = new SchSystem.Model.SchGenInfo();
                                    genmodel.TelNo       = jzTelNo1;
                                    genmodel.RecUser     = Com.Session.userid;
                                    genmodel.RecTime     = DateTime.Now;
                                    genmodel.LastRecUser = Com.Session.userid;
                                    genmodel.LastRecTime = DateTime.Now;
                                    genid = genBll.Add(genmodel);
                                }
                                if (genid > 0)//插成功或者获取成功,则往关联表插数据
                                {
                                    SchSystem.Model.SchStuGenUn genunmodel = new SchSystem.Model.SchStuGenUn();
                                    genunmodel.StuId    = stuids;
                                    genunmodel.GenId    = genid;
                                    genunmodel.GenName  = jzGenName1;
                                    genunmodel.Relation = Relation1 == "" ? "其他" : Relation1;
                                    genunBll.Add(genunmodel);
                                }
                            }
                            //对第二个家长进行处理
                            if (Convert.ToString(jzGenName2) != "" && Convert.ToString(jzTelNo2) != "")
                            {
                                int genid = genBll.GetMbId(jzTelNo2);
                                if (genid == 0)//无号码存在,则插数据
                                {
                                    SchSystem.Model.SchGenInfo genmodel = new SchSystem.Model.SchGenInfo();
                                    genmodel.TelNo       = jzTelNo2;
                                    genmodel.RecUser     = Com.Session.userid;
                                    genmodel.RecTime     = DateTime.Now;
                                    genmodel.LastRecUser = Com.Session.userid;
                                    genmodel.LastRecTime = DateTime.Now;
                                    genid = genBll.Add(genmodel);
                                }
                                if (genid > 0)//插成功或者获取成功,则往关联表插数据
                                {
                                    SchSystem.Model.SchStuGenUn genunmodel = new SchSystem.Model.SchStuGenUn();
                                    genunmodel.StuId    = stuids;
                                    genunmodel.GenId    = genid;
                                    genunmodel.GenName  = jzGenName2;
                                    genunmodel.Relation = Relation2 == "" ? "其他" : Relation2;
                                    genunBll.Add(genunmodel);
                                }
                            }
                        }
                        rsp.code = "success";
                        rsp.msg  = "保存成功";
                    }
                    else
                    {
                        rsp.code = "error";
                        rsp.msg  = errorstr;
                    }
                }
                catch (Exception ex)
                {
                    rsp.code = "error";
                    rsp.msg  = ex.Message;
                }
            }

            return(rsp);
        }