示例#1
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);
        }