/// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="Top">大于0取前几行数据,否则取全部</param>
        /// <param name="whereStr">where条件</param>
        /// <param name="filedOrder">排序字段Order By + filedOrder (不可为空)</param>
        /// <returns></returns>
        public Model.classroom_user GetModel(int Top, string whereStr, string filedOrder)
        {
            DataTable dt = dal.GetList(Top, whereStr, filedOrder).Tables[0];

            Model.classroom_user model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
        /// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public Model.classroom_user GetModel(string whereStr)
        {
            DataTable dt = dal.GetList(whereStr).Tables[0];

            Model.classroom_user model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
Exemplo n.º 3
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_classroom_user", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtclassroom_id.Text.Trim() == "" || txtclassroom_id.Text.Trim().Length > 4)
            {
                strError += "课堂ID为空或超出长度![br]";
            }
            if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4)
            {
                strError += "用户ID为空或超出长度![br]";
            }
            if (txtcontents.Text.Trim() == "" || txtcontents.Text.Trim().Length > 200)
            {
                strError += "申请内容为空或超出长度![br]";
            }
            if (txtstatus.Text.Trim() == "" || txtstatus.Text.Trim().Length > 4)
            {
                strError += "审核状态为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "申请时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.classroom_user model = new Model.classroom_user();
            BLL.classroom_user   bll   = new BLL.classroom_user();

            model.classroom_id = Convert.ToInt32(txtclassroom_id.Text);
            model.user_id      = Convert.ToInt32(txtuser_id.Text);
            model.contents     = Convert.ToString(txtcontents.Text);
            model.status       = Convert.ToInt32(txtstatus.Text);
            model.add_time     = Convert.ToDateTime(txtadd_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加课堂用户关系信息,主键:" + id); //记录日志
                JscriptMsg("添加课堂用户关系信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemplo n.º 4
0
 private void BindInfo()
 {
     BLL.classroom_user   bll   = new BLL.classroom_user();
     Model.classroom_user model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtclassroom_id.Text = model.classroom_id + "";
     txtuser_id.Text      = model.user_id + "";
     txtcontents.Text     = model.contents + "";
     txtstatus.Text       = model.status + "";
     txtadd_time.Text     = model.add_time + "";
 }
Exemplo n.º 5
0
        private void ExamineVerify(HttpContext context)
        {
            int id   = RequestHelper.GetFormInt("id");
            int type = RequestHelper.GetFormInt("type");

            BLL.classroom_user   bll   = new BLL.classroom_user();
            Model.classroom_user model = bll.GetModel(id);
            if (model != null)
            {
                model.status = type;

                bll.Update(model);
            }

            context.Response.Write("1");
            context.Response.End();
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.classroom_user model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"Insert Into ybd_classroom_user(
                classroom_id            
                            ,user_id            
                            ,contents            
                            ,status            
                            ,add_time            
             ) Values (
                @classroom_id               
                            ,@user_id               
                            ,@contents               
                            ,@status               
                            ,@add_time               
             );
            SELECT @@IDENTITY;");

            SqlParameter[] parameters =
            {
                new SqlParameter("@classroom_id", SqlDbType.Int,                                 4)
                ,                                 new SqlParameter("@user_id",  SqlDbType.Int, 4)
                ,                                 new SqlParameter("@contents", SqlDbType.NVarChar, 200)
                ,                                 new SqlParameter("@status",   SqlDbType.Int, 4)
                ,                                 new SqlParameter("@add_time", SqlDbType.DateTime, 8)
            };
            parameters[0].Value = model.classroom_id;
            parameters[1].Value = model.user_id;
            parameters[2].Value = model.contents;
            parameters[3].Value = model.status;
            parameters[4].Value = model.add_time;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 7
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_classroom_user", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.classroom_user   bll   = new BLL.classroom_user();
            Model.classroom_user model = bll.GetModel(this.id);

            model.classroom_id = Convert.ToInt32(txtclassroom_id.Text);
            model.user_id      = Convert.ToInt32(txtuser_id.Text);
            model.contents     = Convert.ToString(txtcontents.Text);
            model.status       = Convert.ToInt32(txtstatus.Text);
            model.add_time     = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改课堂用户关系信息,主键:" + id); //记录日志
                JscriptMsg("修改课堂用户关系信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.classroom_user model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"UPDATE ybd_classroom_user SET 
                classroom_id = @classroom_id
                ,user_id = @user_id
                ,contents = @contents
                ,status = @status
                ,add_time = @add_time
            WHERE id = @id");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int,                       4)
                ,                       new SqlParameter("@classroom_id", SqlDbType.Int, 4)
                ,                       new SqlParameter("@user_id",      SqlDbType.Int, 4)
                ,                       new SqlParameter("@contents",     SqlDbType.NVarChar, 200)
                ,                       new SqlParameter("@status",       SqlDbType.Int, 4)
                ,                       new SqlParameter("@add_time",     SqlDbType.DateTime, 8)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.classroom_id;
            parameters[2].Value = model.user_id;
            parameters[3].Value = model.contents;
            parameters[4].Value = model.status;
            parameters[5].Value = model.add_time;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.classroom_user DataRowToModel(DataRow row)
 {
     Model.classroom_user model = new Model.classroom_user();
     if (row != null)
     {
         if (row["id"] != null) //&& row["id"].ToString() != ""
         {
             model.id = Convert.ToInt32(row["id"]);
         }
         if (row["classroom_id"] != null) //&& row["classroom_id"].ToString() != ""
         {
             model.classroom_id = Convert.ToInt32(row["classroom_id"]);
         }
         if (row["user_id"] != null) //&& row["user_id"].ToString() != ""
         {
             model.user_id = Convert.ToInt32(row["user_id"]);
         }
         if (row["contents"] != null) //&& row["contents"].ToString() != ""
         {
             model.contents = Convert.ToString(row["contents"]);
         }
         if (row["status"] != null) //&& row["status"].ToString() != ""
         {
             model.status = Convert.ToInt32(row["status"]);
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = Convert.ToDateTime(row["add_time"]);
         }
         return(model);
     }
     else
     {
         return(null);
     }
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.classroom_user model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.classroom_user model)
 {
     return(dal.Add(model));
 }