Example #1
0
        public IList <GZS.Model.Menu.SysMenuTab> GetList()
        {
            IList <GZS.Model.Menu.SysMenuTab> list = new List <GZS.Model.Menu.SysMenuTab>();
            string sql = "select  * from sysMenuTab";

            using (SqlDataReader reader = DbHelperSQL.ExecuteReader(sql))
            {
                while (reader.Read())
                {
                    GZS.Model.Menu.SysMenuTab menu = new GZS.Model.Menu.SysMenuTab();
                    menu.SCheck      = (int)reader["SCheck"];
                    menu.sid         = (int)reader["sid"];
                    menu.SisActive   = (int)reader["SisActive"];
                    menu.SName       = reader["SName"].ToString();
                    menu.SParentCode = (int)reader["SParentCode"];
                    menu.Starget     = reader["Starget"].ToString();
                    menu.Surl        = reader["Surl"].ToString();
                    menu.SCode       = reader["SCode"].ToString();
                    menu.SDate       = Convert.ToDateTime(reader["SDate"]);
                    menu.Sorder      = (int)reader["SOrder"];
                    menu.Sparentsid  = (int)reader["SParentSid"];
                    list.Add(menu);
                }
            }
            return(list);
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public GZS.Model.Menu.SysMenuTab GetModel(int sid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 sid,SName,SCheck,Surl,SisActive,SParentCode,SCode,Starget,SDate,SOrder,SParentSid from SysMenuTab ");
            strSql.Append(" where sid=@sid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sid", SqlDbType.Int, 4)
            };
            parameters[0].Value = sid;

            GZS.Model.Menu.SysMenuTab model = new GZS.Model.Menu.SysMenuTab();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["sid"].ToString() != "")
                {
                    model.sid = int.Parse(ds.Tables[0].Rows[0]["sid"].ToString());
                }
                model.SName = ds.Tables[0].Rows[0]["SName"].ToString();
                if (ds.Tables[0].Rows[0]["SCheck"].ToString() != "")
                {
                    model.SCheck = int.Parse(ds.Tables[0].Rows[0]["SCheck"].ToString());
                }
                model.Surl = ds.Tables[0].Rows[0]["Surl"].ToString();
                if (ds.Tables[0].Rows[0]["SisActive"].ToString() != "")
                {
                    model.SisActive = int.Parse(ds.Tables[0].Rows[0]["SisActive"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SParentCode"].ToString() != "")
                {
                    model.SParentCode = int.Parse(ds.Tables[0].Rows[0]["SParentCode"].ToString());
                }
                model.SCode   = ds.Tables[0].Rows[0]["SCode"].ToString();
                model.Starget = ds.Tables[0].Rows[0]["Starget"].ToString();
                if (ds.Tables[0].Rows[0]["SDate"].ToString() != "")
                {
                    model.SDate = DateTime.Parse(ds.Tables[0].Rows[0]["SDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SOrder"].ToString() != "")
                {
                    model.Sorder = int.Parse(ds.Tables[0].Rows[0]["SOrder"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SParentSid"].ToString() != "")
                {
                    model.Sparentsid = int.Parse(ds.Tables[0].Rows[0]["SParentSid"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(GZS.Model.Menu.SysMenuTab model)
        {
            int  identity = 0;
            bool a        = false;

            SqlParameter[] parameters =
            {
                new SqlParameter("@sid",         SqlDbType.Int,       4),
                new SqlParameter("@SName",       SqlDbType.VarChar, 100),
                new SqlParameter("@SCheck",      SqlDbType.Int,       4),
                new SqlParameter("@Surl",        SqlDbType.VarChar, 300),
                new SqlParameter("@SisActive",   SqlDbType.Int,       4),
                new SqlParameter("@SParentCode", SqlDbType.Int,       4),
                new SqlParameter("@SCode",       SqlDbType.VarChar, 200),
                new SqlParameter("@Starget",     SqlDbType.VarChar,  50),
                new SqlParameter("@SOrder",      SqlDbType.Int,       4),
                new SqlParameter("@SParentSid",  SqlDbType.Int,       4),
                new SqlParameter("@identity",    SqlDbType.Int, 4)
            };
            parameters[0].Value      = model.sid;
            parameters[1].Value      = model.SName;
            parameters[2].Value      = model.SCheck;
            parameters[3].Value      = model.Surl;
            parameters[4].Value      = model.SisActive;
            parameters[5].Value      = model.SParentCode;
            parameters[6].Value      = model.SCode;
            parameters[7].Value      = model.Starget;
            parameters[8].Value      = model.Sorder;
            parameters[9].Value      = model.Sparentsid;
            parameters[10].Direction = ParameterDirection.Output;
            try
            {
                a = DbHelperSQL.RunProcLob("SysMenuTab_insert", parameters);
            }
            catch (Exception ex2)
            {
                throw ex2;
            }
            if (a)
            {
                if (parameters[10].Value != null)
                {
                    identity = Convert.ToInt32(parameters[10].Value);
                }
                else
                {
                    identity = 0;
                }
            }
            return(identity);
        }
Example #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <GZS.Model.Menu.SysMenuTab> DataTableToList(DataTable dt)
        {
            List <GZS.Model.Menu.SysMenuTab> modelList = new List <GZS.Model.Menu.SysMenuTab>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                GZS.Model.Menu.SysMenuTab model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new GZS.Model.Menu.SysMenuTab();
                    if (dt.Rows[n]["sid"].ToString() != "")
                    {
                        model.sid = int.Parse(dt.Rows[n]["sid"].ToString());
                    }
                    model.SName = dt.Rows[n]["SName"].ToString();
                    if (dt.Rows[n]["SCheck"].ToString() != "")
                    {
                        model.SCheck = int.Parse(dt.Rows[n]["SCheck"].ToString());
                    }
                    model.Surl = dt.Rows[n]["Surl"].ToString();
                    if (dt.Rows[n]["SisActive"].ToString() != "")
                    {
                        model.SisActive = int.Parse(dt.Rows[n]["SisActive"].ToString());
                    }
                    if (dt.Rows[n]["SParentCode"].ToString() != "")
                    {
                        model.SParentCode = int.Parse(dt.Rows[n]["SParentCode"].ToString());
                    }
                    model.SCode   = dt.Rows[n]["SCode"].ToString();
                    model.Starget = dt.Rows[n]["Starget"].ToString();
                    if (dt.Rows[n]["SDate"].ToString() != "")
                    {
                        model.SDate = DateTime.Parse(dt.Rows[n]["SDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(GZS.Model.Menu.SysMenuTab model)
        {
            bool a = false;

            SqlParameter[] parameters =
            {
                new SqlParameter("@sid",         SqlDbType.Int,       4),
                new SqlParameter("@SName",       SqlDbType.VarChar, 100),
                new SqlParameter("@SCheck",      SqlDbType.Int,       4),
                new SqlParameter("@Surl",        SqlDbType.VarChar, 300),
                new SqlParameter("@SisActive",   SqlDbType.Int,       4),
                new SqlParameter("@SParentCode", SqlDbType.Int,       4),
                new SqlParameter("@SCode",       SqlDbType.VarChar, 200),
                new SqlParameter("@Starget",     SqlDbType.VarChar,  50),
                new SqlParameter("@SOrder",      SqlDbType.Int,       4),
                new SqlParameter("@SParentSid",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.sid;
            parameters[1].Value = model.SName;
            parameters[2].Value = model.SCheck;
            parameters[3].Value = model.Surl;
            parameters[4].Value = model.SisActive;
            parameters[5].Value = model.SParentCode;
            parameters[6].Value = model.SCode;
            parameters[7].Value = model.Starget;
            parameters[8].Value = model.Sorder;
            parameters[9].Value = model.Sparentsid;
            try
            {
                a = DbHelperSQL.RunProcLob("SysMenuTab_insert", parameters);
            }
            catch (Exception ex2)
            {
                throw ex2;
            }
            return(a);
        }
Example #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GZS.Model.Menu.SysMenuTab model)
 {
     return(dal.Update(model));
 }
Example #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(GZS.Model.Menu.SysMenuTab model)
 {
     return(dal.Add(model));
 }