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

            strSql.Append("insert into SchAppRoleXXT(");
            strSql.Append("SchId,AppStr,RecTime,RecUser)");
            strSql.Append(" values (");
            strSql.Append("@SchId,@AppStr,@RecTime,@RecUser)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SchId",   SqlDbType.Int,              4),
                new SqlParameter("@AppStr",  SqlDbType.VarChar,        100),
                new SqlParameter("@RecTime", SqlDbType.SmallDateTime),
                new SqlParameter("@RecUser", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.SchId;
            parameters[1].Value = model.AppStr;
            parameters[2].Value = model.RecTime;
            parameters[3].Value = model.RecUser;

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

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

            strSql.Append("update SchAppRoleXXT set ");
            strSql.Append("AppStr=@AppStr,");
            strSql.Append("LastRecTime=@LastRecTime,");
            strSql.Append("LastRecUser=@LastRecUser");
            strSql.Append(" where SchId=@SchId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AppStr",      SqlDbType.VarChar,   100),
                new SqlParameter("@LastRecTime", SqlDbType.DateTime),
                new SqlParameter("@LastRecUser", SqlDbType.VarChar,    20),
                new SqlParameter("@SchId",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.AppStr;
            parameters[1].Value = model.LastRecTime;
            parameters[2].Value = model.LastRecUser;
            parameters[3].Value = model.SchId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 /// <summary>
 /// 家校互通平台子模块
 /// </summary>
 /// <param name="homschmodules"></param>
 /// <param name="schid"></param>
 public static void schxxtSonModel(string homschmodules, int schid)
 {
     if (homschmodules != "")
     {
         SchSystem.BLL.SchAppRoleXXT   sarxxtBll   = new SchSystem.BLL.SchAppRoleXXT();
         SchSystem.Model.SchAppRoleXXT sarxxtModel = new SchSystem.Model.SchAppRoleXXT();
         sarxxtModel.SchId  = schid;
         sarxxtModel.AppStr = homschmodules;
         if (sarxxtBll.SchAppExists(schid))
         {
             sarxxtModel.LastRecTime = DateTime.Now;
             sarxxtModel.LastRecUser = Com.Session.userid;
             sarxxtBll.Update(sarxxtModel);
         }
         else
         {
             sarxxtModel.RecTime = DateTime.Now;
             sarxxtModel.RecUser = Com.Session.userid;
             sarxxtBll.Add(sarxxtModel);
         }
     }
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SchSystem.Model.SchAppRoleXXT DataRowToModel(DataRow row)
 {
     SchSystem.Model.SchAppRoleXXT model = new SchSystem.Model.SchAppRoleXXT();
     if (row != null)
     {
         if (row["AutoId"] != null && row["AutoId"].ToString() != "")
         {
             model.AutoId = int.Parse(row["AutoId"].ToString());
         }
         if (row["SchId"] != null && row["SchId"].ToString() != "")
         {
             model.SchId = int.Parse(row["SchId"].ToString());
         }
         if (row["AppStr"] != null)
         {
             model.AppStr = row["AppStr"].ToString();
         }
         if (row["RecTime"] != null && row["RecTime"].ToString() != "")
         {
             model.RecTime = DateTime.Parse(row["RecTime"].ToString());
         }
         if (row["RecUser"] != null)
         {
             model.RecUser = row["RecUser"].ToString();
         }
         if (row["LastRecTime"] != null && row["LastRecTime"].ToString() != "")
         {
             model.LastRecTime = DateTime.Parse(row["LastRecTime"].ToString());
         }
         if (row["LastRecUser"] != null)
         {
             model.LastRecUser = row["LastRecUser"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SchSystem.Model.SchAppRoleXXT GetModel(int AutoId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 AutoId,SchId,AppStr,RecTime,RecUser,LastRecTime,LastRecUser from SchAppRoleXXT ");
            strSql.Append(" where AutoId=@AutoId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AutoId", SqlDbType.Int, 4)
            };
            parameters[0].Value = AutoId;

            SchSystem.Model.SchAppRoleXXT model = new SchSystem.Model.SchAppRoleXXT();
            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 #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SchSystem.Model.SchAppRoleXXT model)
 {
     return(dal.Update(model));
 }
Example #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SchSystem.Model.SchAppRoleXXT model)
 {
     return(dal.Add(model));
 }