Example #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.SQMSys.Tb_Sys_Role GetModel(string RoleCode, Guid StreetCode)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleCode",   SqlDbType.NVarChar, 50),
                new SqlParameter("@StreetCode", SqlDbType.UniqueIdentifier)
            };
            parameters[0].Value = RoleCode;
            parameters[1].Value = StreetCode;

            MobileSoft.Model.SQMSys.Tb_Sys_Role model = new MobileSoft.Model.SQMSys.Tb_Sys_Role();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Sys_Role_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.RoleCode = ds.Tables[0].Rows[0]["RoleCode"].ToString();
                if (ds.Tables[0].Rows[0]["StreetCode"].ToString() != "")
                {
                    model.StreetCode = new Guid(ds.Tables[0].Rows[0]["StreetCode"].ToString());
                }
                model.RoleName     = ds.Tables[0].Rows[0]["RoleName"].ToString();
                model.RoleDescribe = ds.Tables[0].Rows[0]["RoleDescribe"].ToString();
                if (ds.Tables[0].Rows[0]["IsSysRole"].ToString() != "")
                {
                    model.IsSysRole = int.Parse(ds.Tables[0].Rows[0]["IsSysRole"].ToString());
                }
                model.DepCode     = ds.Tables[0].Rows[0]["DepCode"].ToString();
                model.SysRoleCode = ds.Tables[0].Rows[0]["SysRoleCode"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.SQMSys.Tb_Sys_Role model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleCode",     SqlDbType.NVarChar,           20),
                new SqlParameter("@StreetCode",   SqlDbType.UniqueIdentifier,   16),
                new SqlParameter("@RoleName",     SqlDbType.NVarChar,           50),
                new SqlParameter("@RoleDescribe", SqlDbType.NVarChar,         1000),
                new SqlParameter("@IsSysRole",    SqlDbType.SmallInt,            2),
                new SqlParameter("@DepCode",      SqlDbType.NVarChar,           20),
                new SqlParameter("@SysRoleCode",  SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = model.RoleCode;
            parameters[1].Value = model.StreetCode;
            parameters[2].Value = model.RoleName;
            parameters[3].Value = model.RoleDescribe;
            parameters[4].Value = model.IsSysRole;
            parameters[5].Value = model.DepCode;
            parameters[6].Value = model.SysRoleCode;

            DbHelperSQL.RunProcedure("Proc_Tb_Sys_Role_Update", parameters, out rowsAffected);
        }