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

            strSql.Append("insert into SchAppRoleSoure(");
            strSql.Append("SchId,AppCode,RecTime,RecUser)");
            strSql.Append(" values (");
            strSql.Append("@SchId,@AppCode,@RecTime,@RecUser)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SchId",   SqlDbType.Int,              4),
                new SqlParameter("@AppCode", SqlDbType.VarChar,        300),
                new SqlParameter("@RecTime", SqlDbType.SmallDateTime),
                new SqlParameter("@RecUser", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.SchId;
            parameters[1].Value = model.AppCode;
            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));
            }
        }
Exemple #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SchSystem.Model.SchAppRoleSoure model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SchAppRoleSoure set ");
            strSql.Append("AppCode=@AppCode,");
            strSql.Append("LastRecTime=@LastRecTime,");
            strSql.Append("LastRecUser=@LastRecUser");
            strSql.Append(" where SchId=@SchId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AppCode",     SqlDbType.VarChar,   300),
                new SqlParameter("@LastRecTime", SqlDbType.DateTime),
                new SqlParameter("@LastRecUser", SqlDbType.VarChar,    20),
                new SqlParameter("@SchId",       SqlDbType.Int, 6)
            };
            parameters[0].Value = model.AppCode;
            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);
            }
        }
Exemple #3
0
 public static Com.DataPack.DataRsp <string> schsubsave(string arr)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "页面已经过期,请重新登录";
     }
     else
     {
         string[] datas = arr.Split('#');
         if (datas[0] == "")
         {
             rsp.code = "tips";
             rsp.msg  = "没有相关学校数据";
         }
         else
         {
             try
             {
                 SchSystem.BLL.SchAppRoleSoure   srsBll   = new SchSystem.BLL.SchAppRoleSoure();
                 SchSystem.Model.SchAppRoleSoure srsModel = new SchSystem.Model.SchAppRoleSoure();
                 srsModel.SchId   = int.Parse(datas[0]);
                 srsModel.AppCode = datas[1];
                 if (srsBll.SchAppExists(int.Parse(datas[0])))
                 {
                     srsModel.LastRecTime = DateTime.Now;
                     srsModel.LastRecUser = Com.Session.uname;
                     srsBll.Update(srsModel);
                 }
                 else
                 {
                     srsModel.RecTime = DateTime.Now;
                     srsModel.RecUser = Com.Session.uname;
                     srsBll.Add(srsModel);
                 }
                 rsp.code = "success";
                 rsp.msg  = "修改成功!";
             }
             catch (Exception ex)
             {
                 rsp.code = "error";
                 rsp.msg  = ex.Message;
             }
         }
     }
     return(rsp);
 }
Exemple #4
0
 /// <summary>
 /// 资源模块
 /// </summary>
 /// <param name="resourcemodules"></param>
 /// <param name="schid"></param>
 public static void ResourcesModel(string resourcemodules, int schid)
 {
     if (resourcemodules != "")
     {
         SchSystem.BLL.SchAppRoleSoure   srsBll   = new SchSystem.BLL.SchAppRoleSoure();
         SchSystem.Model.SchAppRoleSoure srsModel = new SchSystem.Model.SchAppRoleSoure();
         srsModel.SchId   = schid;
         srsModel.AppCode = resourcemodules;
         if (srsBll.SchAppExists(schid))
         {
             srsModel.LastRecTime = DateTime.Now;
             srsModel.LastRecUser = Com.Session.userid;
             srsBll.Update(srsModel);
         }
         else
         {
             srsModel.RecTime = DateTime.Now;
             srsModel.RecUser = Com.Session.userid;
             srsBll.Add(srsModel);
         }
     }
 }
Exemple #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SchSystem.Model.SchAppRoleSoure DataRowToModel(DataRow row)
 {
     SchSystem.Model.SchAppRoleSoure model = new SchSystem.Model.SchAppRoleSoure();
     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["AppCode"] != null)
         {
             model.AppCode = row["AppCode"].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);
 }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SchSystem.Model.SchAppRoleSoure GetModel(int AutoId)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }