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

            using (SqlDataReader reader = crm.ExecuteReaders(sql))
            {
                while (reader.Read())
                {
                    Tz888.Model.dp.SysMenuTab menu = new Tz888.Model.dp.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);
        }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tz888.Model.dp.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;

            Tz888.Model.dp.SysMenuTab model = new Tz888.Model.dp.SysMenuTab();
            DataSet ds = crm.Querys(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);
            }
        }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Tz888.Model.dp.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 = crm.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);
        }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Tz888.Model.dp.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 = crm.RunProcLob("SysMenuTab_insert", parameters);
            }
            catch (Exception ex2)
            {
                throw ex2;
            }
            return(a);
        }