public void add(TeacherBindInfoModel teacherbindinfo)
        {
            SqlConnection cn = null;
            SqlTransaction tc = null;
            try
            {
                cn = DbHelperSQL.getConnection();
                tc = DbHelperSQL.startTransaction(cn);

                //执行新增写进数据库
            teacherbindinfoDal.add(cn, tc, teacherbindinfo);

                DbHelperSQL.commitTransaction(tc);
            }
            catch (Exception dalEx)
            {
                DbHelperSQL.rollBackTransaction(tc);
                throw new MakeException(ExpSort.数据库, dalEx.Message);
            }
            finally
            {
                DbHelperSQL.closeConnection(cn);
            }
        }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (OpenId.Length < 10)
     {
     //            Script.alertMsg("获取不到openid,请先关注我们的公众品台再从微信端登录", Page);
         Response.Redirect("Error.aspx");
         return;
     }
     //先判断openid是否已经绑定了家长或教师
     IList<QueryModel> qmList = new List<QueryModel>();
     qmList.Add(MakeUtil.getQueryModel("OpenId", "'", SqlWhere.WhereOperator.Equal, OpenId));
     ParentBindInfoModels = _isjDepartStaffEbi.GetStudentParentDtoList(qmList, -1);
     ParentsRepeater.DataSource = ParentBindInfoModels;
     TeacherBindInfoModel = _teacherBindInfoEbi.getModel(qmList);
     this.DataBind();
 }
Example #3
0
    protected void TeacherBindClick(object sender, EventArgs e)
    {
        IList<QueryModel> qmList = new List<QueryModel>();
        var teacherId = MakeUtil.getStringFromRequestByName(Request, "TeacherId", -1);
        var schoolNo = MakeUtil.getStringFromRequestByName(Request, "SchoolNo", -1);
        var teacherName = MakeUtil.getStringFromRequestByName(Request, "TeacherName", -1);

        if (TeacherBindInfoModel.OpenId.Length > 0)
        {
            Script.alertMsg("绑定失败!你的公众号已经绑定了一个教师编号,不能重复绑定", Page);
            return;
        }
        //教师的绑定就是先用教师的编号检测一下是否已存在了这个编号
        qmList.Add(MakeUtil.getQueryModel("DS_JID", "'", SqlWhere.WhereOperator.Equal, teacherId));
        qmList.Add(MakeUtil.getQueryModel("SchoolNo", "'", SqlWhere.WhereOperator.Equal, schoolNo));
        qmList.Add(MakeUtil.getQueryModel("DS_Name", "'", SqlWhere.WhereOperator.Equal, teacherName));
        if (_isjDepartStaffEbi.getModelList(qmList, -1).Count == 0)
        {
            //如果不存在则绑定失败
            Script.alertMsg("绑定失败!查找不到相关的教师编号,请仔细确认所填写的教师编号和教师名称", Page);
            return;
        }
        qmList.Clear();
        qmList.Add(MakeUtil.getQueryModel("TeacherId", "'", SqlWhere.WhereOperator.Equal, teacherId));
        qmList.Add(MakeUtil.getQueryModel("SchoolNo", "'", SqlWhere.WhereOperator.Equal, schoolNo));
        if (_teacherBindInfoEbi.getModelList(qmList, -1).Count > 0)
        {
            //如果已被绑定则绑定失败
            Script.alertMsg("绑定失败!这个教师编号已被绑定", Page);
            return;
        }

        //如果存在便将教师的编号与openid保存在BingingInformation(暂定)表中
        var tbim = new TeacherBindInfoModel();
        tbim.OpenId = OpenId;
        tbim.TeacherId = teacherId;
        tbim.SchoolNo = schoolNo;
        try
        {
            _teacherBindInfoEbi.add(tbim);
            MakeUtil.addOperationNote(Request.UserHostAddress, "微信前台", "教师微信绑定", OpenId + ":" + teacherId);
            Script.alertMsg("绑定成功", Page);
            Script.scriptRedirect(Request.RawUrl, Page);
        }
        catch (Exception ex)
        {
            Script.alertMsg(ex.Message, Page);
            return;
        }
    }
 public bool update(SqlConnection cn, SqlTransaction tc, TeacherBindInfoModel model)
 {
     return DbHelperSQL.updateModel<TeacherBindInfoModel>(model, "TeacherBindInfo", "OpenId", model.OpenId, "'", cn, tc);
 }
 public bool add(SqlConnection cn, SqlTransaction tc, TeacherBindInfoModel model)
 {
     return DbHelperSQL.insertModel<TeacherBindInfoModel>(model, "TeacherBindInfo", cn, tc);
 }